/* =====================================================
   layout.css — Header & Navigation
   Expense Tracker v0.2.0
   ===================================================== */

/* ── App wrapper ── */
#appScreen { display: none; }

/* ── Header ── */
.app-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  padding: 12px 16px 10px;
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}

/* Logo */
.logo { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.logo-icon {
  width: 38px; height: 38px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
}
.logo-texts { min-width: 0; }
.logo-name { font-size: 16px; font-weight: 900; color: var(--c-text); }
.logo-ver  { font-size: 9px; color: var(--c-text3); letter-spacing: .6px; font-family: var(--font-mono); }

/* Profile button */
.profile-wrap { position: relative; flex-shrink: 0; }
.profile-btn {
  width: 36px; height: 36px; border-radius: 50%; border: none;
  background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
  color: #fff; font-size: 14px; font-weight: 800;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: transform var(--t-base);
}
.profile-btn:active { transform: scale(.93); }

/* Profile dropdown */
.profile-menu {
  position: absolute; top: 44px; right: 0;
  background: var(--c-surface); border: 1px solid var(--c-border);
  border-radius: var(--r-lg); padding: var(--sp-3);
  box-shadow: var(--shadow-lg); width: 230px;
  display: none; z-index: 200;
  animation: scaleIn .2s ease;
}
.profile-menu.open { display: block; }
.profile-info { padding: 8px 6px 12px; border-bottom: 1px solid var(--c-border); margin-bottom: 8px; }
.profile-name  { font-size: 14px; font-weight: 700; }
.profile-email { font-size: 11px; color: var(--c-text2); margin-top: 2px; }

/* Nav tabs */
.nav-tabs {
  display: flex; background: var(--c-surface2);
  border-radius: 10px; padding: 3px; gap: 0;
}
.nav-tab {
  flex: 1; text-align: center; padding: 7px 4px;
  border-radius: 8px; font-size: 12px; font-weight: 700;
  color: var(--c-text3); cursor: pointer;
  transition: all var(--t-base); user-select: none;
}
.nav-tab.active {
  background: var(--c-surface); color: var(--c-primary);
  box-shadow: var(--shadow-sm);
}

/* ── Bottom Nav (alternative for mobile) ── */
/* Using header tabs only — no bottom nav in this version */

/* ══════════════════════════════════════════════════════
   HAMBURGER BUTTON
   ══════════════════════════════════════════════════════ */
.hamburger-btn {
  width: 36px; height: 36px; border: none; background: transparent;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 5px; cursor: pointer; padding: 4px;
  border-radius: 8px; flex-shrink: 0;
  transition: background var(--t-base);
}
.hamburger-btn:active { background: var(--c-surface2); }
.hamburger-btn span {
  display: block; width: 20px; height: 2px;
  background: var(--c-text); border-radius: 2px;
}

/* ══════════════════════════════════════════════════════
   MOBILE DRAWER
   ══════════════════════════════════════════════════════ */

/* 오버레이 배경 */
.drawer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.45); z-index: 300;
}
.drawer-overlay.open { display: block; animation: fadeIn .2s ease; }

/* 드로어 패널 */
.mobile-drawer {
  position: fixed; top: 0; left: 0;
  width: 260px; height: 100vh;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  box-shadow: var(--shadow-lg); z-index: 400;
  transform: translateX(-100%);
  transition: transform .26s cubic-bezier(.22,1,.36,1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.mobile-drawer.open { transform: translateX(0); }

/* 드로어 헤더 */
.drawer-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.drawer-logo { display: flex; align-items: center; gap: 10px; }
.drawer-logo-icon {
  width: 34px; height: 34px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.drawer-logo-name { font-size: 15px; font-weight: 900; color: var(--c-text); }
.drawer-close-btn {
  width: 32px; height: 32px; border: none;
  background: var(--c-surface2); border-radius: 8px;
  cursor: pointer; font-size: 16px; color: var(--c-text2);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--t-base);
}
.drawer-close-btn:active { background: var(--c-border); }

/* 드로어 네비게이션 */
.drawer-nav {
  flex: 1; padding: 12px 10px;
  display: flex; flex-direction: column; gap: 2px;
  overflow-y: auto;
}
.drawer-nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 14px; border-radius: 8px;
  font-size: 15px; font-weight: 600; color: var(--c-text2);
  cursor: pointer; transition: all var(--t-base); user-select: none;
}
.drawer-nav-item:active { background: var(--c-surface2); }
.drawer-nav-item.active {
  background: var(--c-surface2); color: var(--c-primary);
}

/* 드로어 하단 (버전) */
.drawer-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
}
.drawer-ver {
  font-size: 11px; color: var(--c-text3);
  font-family: var(--font-mono); letter-spacing: .6px;
}

/* ══════════════════════════════════════════════════════
   PC SIDEBAR LAYOUT (≥768px)
   모바일: 기존 상단 탭 유지 / PC: 좌측 사이드바
   ══════════════════════════════════════════════════════ */
@media (min-width: 768px) {

  /* 햄버거·모바일 드로어 숨기기 */
  .hamburger-btn  { display: none; }
  .mobile-drawer  { display: none; }
  .drawer-overlay { display: none !important; }

  /* 헤더: nav-tabs 숨기고 하단 패딩 조정 */
  .nav-tabs { display: none; }
  .header-top { margin-bottom: 0; }
  .app-header { padding-bottom: 12px; }

  /* 두 컬럼 레이아웃 */
  .app-body {
    display: flex;
    align-items: flex-start;
  }

  /* 좌측 사이드바 */
  .pc-sidebar {
    width: 210px;
    flex-shrink: 0;
    background: var(--c-surface);
    border-right: 1px solid var(--c-border);
    padding: 20px 10px;
    position: sticky;
    top: 62px; /* 헤더 높이 (nav-tabs 없을 때) */
    max-height: calc(100vh - 62px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }

  /* 사이드바 구분선 */
  .sidebar-divider {
    height: 1px;
    background: var(--c-border);
    margin: 8px 6px;
  }

  /* 사이드바 네비게이션 항목 */
  .sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--c-text2);
    cursor: pointer;
    transition: all var(--t-base);
    user-select: none;
    white-space: nowrap;
  }
  .sidebar-nav-item:hover {
    background: var(--c-surface2);
    color: var(--c-text);
  }
  .sidebar-nav-item.active {
    background: var(--c-surface2);
    color: var(--c-primary);
  }
  .sidebar-icon {
    font-size: 17px;
    width: 22px;
    text-align: center;
    flex-shrink: 0;
  }

  /* 콘텐츠 영역 */
  .content {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 210px);
  }

  /* 사이드바 버전 표시 (맨 하단) */
  .sidebar-ver {
    margin-top: auto;
    padding: 10px 14px 4px;
    font-size: 11px; color: var(--c-text3);
    font-family: var(--font-mono); letter-spacing: .6px;
  }
}

/* 모바일: 사이드바 숨기기, nav-tabs 숨기고 헤더 여백 정리 */
@media (max-width: 767px) {
  .pc-sidebar { display: none; }
  .nav-tabs    { display: none; }
  .header-top  { margin-bottom: 0; }
  .app-header  { padding-bottom: 12px; }
}
