/* ============================================================ */
/* Alts-DevCenter 사이드바 — AltsCodex 시안 톤                    */
/* ============================================================ */
/* 디자인 토큰 임포트 — 모든 사이드바 페이지가 이 파일을 통해     */
/* 자동으로 시안 토큰 + Audiowide / Neo둥근모 폰트를 로드.        */
/* ============================================================ */
@import url("design_tokens.css");

/* ── 사이드바 색상 변수 (디자인 토큰과 매칭) ─────────────────── */
:root {
  /* 폭 240 → 288 (20% 증가) — 로고 + 라이브 라벨 여유 확보. */
  /* content-wrapper 의 margin-left 도 동일 변수 참조하므로 자동 동기화. */
  --sidebar-width: 288px;
  --sidebar-bg: #050510;                       /* surface-base 와 매칭 */
  --sidebar-border: rgba(0, 255, 224, 0.15);   /* 시안 보더 */
  --sidebar-text: #E8E8F0;                     /* text-primary */
  --sidebar-text-secondary: #6A6A88;           /* text-tertiary */
  --sidebar-hover-bg: rgba(0, 255, 224, 0.08); /* 시안 호버 */
  --sidebar-active-bg: rgba(0, 255, 224, 0.10);
  --sidebar-active-text: #00FFE0;              /* 시안 메인 (구 라임 #00FFE0 폐기) */
  --sidebar-shadow:
    0 1px 2px 0 rgba(0, 0, 0, 0.5),
    0 1px 3px 1px rgba(0, 0, 0, 0.3),
    0 0 16px rgba(0, 255, 224, 0.04);          /* 미세 시안 글로우 */
  --header-height: 64px;
  --transition-speed: 0.3s;
}

/* ── 사이드바 라이브 라인 (게임 톤) ──────────────────────────── */
/* 사이드바 헤더 직후. 라이브 펄스 도트 + 디스플레이 폰트 라벨. */
.sidebar-live-strip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 1rem 0.75rem;
  border-bottom: 1px solid var(--border-subtle);
}
.sidebar-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon-primary);
  box-shadow: 0 0 8px var(--neon-primary-60);
  animation: sidebarLivePulse 1.4s ease-in-out infinite;
  flex-shrink: 0;
}
.sidebar-live-label {
  font-family: var(--font-display);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--neon-primary-60);
  text-transform: uppercase;
}
@keyframes sidebarLivePulse {
  0%, 100% { opacity: 1;   box-shadow: 0 0 0 0 var(--neon-primary-60), 0 0 4px var(--neon-primary-60); }
  50%      { opacity: 0.4; box-shadow: 0 0 0 5px var(--neon-primary-04), 0 0 2px var(--neon-primary-30); }
}

/* ── 사이드바 메뉴 텍스트 — 디스플레이 폰트(Audiowide/Neo둥근모) ── */
/* 게임 톤 + 라벨 가독성. transition 보존. */
.sidebar-text {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.05em;
}

/* Body Layout with Sidebar */
body.has-sidebar {
  margin: 0;
  padding: 0;
}

/* Main Content Wrapper */
.content-wrapper {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition-speed) ease;
}

/* Mobile: Full width content */
@media (max-width: 767px) {
  .content-wrapper {
    margin-left: 0;
  }
}

/* Sidebar Container */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition-speed) ease;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Sidebar Header */
.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px;
  border-bottom: 1px solid var(--sidebar-border);
  min-height: var(--header-height);
  position: relative;
}

.sidebar-logo {
  height: 64px;
  max-width: 360px;
  object-fit: contain;
  display: block;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.sidebar-title {
  font-family: 'Space Grotesk', 'Inter', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--sidebar-text);
  margin: 0;
}

.sidebar-close {
  display: none;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--sidebar-text-secondary);
  border-radius: 50%;
  transition: background-color 0.2s;
}

.sidebar-close:hover {
  background-color: var(--sidebar-hover-bg);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 8px 0;
  overflow-y: auto;
}

.sidebar-menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sidebar-item {
  margin: 0;
}

.sidebar-link {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  transition: background-color 0.2s, color 0.2s;
  border-radius: 0 4px 4px 0;
  margin: 2px 8px 2px 0;
  gap: 12px;
}

.sidebar-link:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--sidebar-text);
}

.sidebar-link.active {
  background-color: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.sidebar-icon {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
}

.sidebar-link.active .sidebar-icon {
  stroke: var(--sidebar-active-text);
}

.sidebar-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--sidebar-border);
}

.sidebar-user-info {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: 8px;
  color: var(--sidebar-text-secondary);
  font-size: 14px;
  transition: background-color 0.2s;
  flex: 1;
  min-width: 0;
}

.sidebar-guest-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.sidebar-user.sidebar-guest {
  cursor: default;
}

.sidebar-user.sidebar-guest:hover {
  background-color: transparent;
}

.sidebar-user-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
  color: var(--sidebar-text);
}

.sidebar-logout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
  color: var(--sidebar-text-secondary);
  border-radius: 4px;
  transition: background-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background-color: var(--sidebar-hover-bg);
  color: var(--sidebar-danger, #ef4444);
}

.sidebar-logout-btn:active {
  transform: scale(0.95);
}

.sidebar-login-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 10px 16px;
  background-color: #00FFE0;
  color: #0c0c0c;
  border: none;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  box-shadow: none;
}

.sidebar-login-btn:hover {
  background-color: #00FFE0;
  box-shadow: 2px 2px 0 rgba(0,255,224, 0.3);
}

.sidebar-login-btn:active {
  transform: scale(0.98);
}

.sidebar-login-btn svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

/* Hamburger Toggle Button (Mobile) */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 1100;
  background-color: var(--sidebar-bg);
  border: 1px solid var(--sidebar-border);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  box-shadow: var(--sidebar-shadow);
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  transition: transform 0.2s;
}

.sidebar-toggle:hover {
  transform: scale(1.05);
}

.sidebar-toggle:active {
  transform: scale(0.95);
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background-color: var(--sidebar-text);
  border-radius: 2px;
  transition: all 0.3s ease;
}

/* Sidebar Overlay (Mobile) */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 999;
  opacity: 0;
  transition: opacity var(--transition-speed) ease;
}

/* Mobile Styles */
@media (max-width: 767px) {
  /* Show hamburger button */
  .sidebar-toggle {
    display: flex;
  }
  
  /* Show close button in sidebar */
  .sidebar-close {
    display: block;
  }
  
  /* Hide sidebar by default */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: var(--sidebar-shadow);
  }
  
  /* Show sidebar when active */
  .sidebar.active {
    transform: translateX(0);
  }
  
  /* Show overlay when sidebar is active */
  .sidebar-overlay.active {
    display: block;
    opacity: 1;
  }
  
  /* Animate hamburger to X when sidebar is open */
  .sidebar-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }
  
  .sidebar-toggle.active .hamburger-line:nth-child(2) {
    opacity: 0;
  }
  
  .sidebar-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }
}

/* Tablet Adjustments */
@media (min-width: 768px) and (max-width: 1024px) {
  :root {
    /* 220 → 264 (20% 증가, 데스크탑 288 비례 유지) */
    --sidebar-width: 264px;
  }
  
  .sidebar-title {
    font-size: 18px;
  }
  
  .sidebar-link {
    font-size: 13px;
    padding: 8px 12px;
  }
}

/* Scrollbar Styling for Sidebar */
.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #333;
  border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #444;
}

/* Smooth Scrolling */
.sidebar-nav {
  scroll-behavior: smooth;
}

/* Focus States for Accessibility */
.sidebar-link:focus,
.sidebar-toggle:focus,
.sidebar-close:focus {
  outline: 2px solid var(--sidebar-active-text);
  outline-offset: 2px;
}

/* Print Styles */
@media print {
  .sidebar,
  .sidebar-toggle,
  .sidebar-overlay {
    display: none !important;
  }
  
  .content-wrapper {
    margin-left: 0 !important;
  }
}

@keyframes slideInFromLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Reduce motion for accessibility */
@media (prefers-reduced-motion: reduce) {
  .sidebar,
  .sidebar-toggle,
  .sidebar-link,
  .sidebar-overlay,
  .content-wrapper,
  .hamburger-line {
    animation: none;
    transition: none;
  }
}
