/* ═══════════════════════════════════════════════════════
   CFA.PREP v2 — Navigation & Layout (Premium)
   Desktop: horizontal top nav (wide)
   Mobile:  hamburger → full slide-out drawer
   ═══════════════════════════════════════════════════════ */

/* ── TOP HEADER ── */
.top-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(226,232,240,.7);
  z-index: 1000;
  display: flex;
  align-items: center;
  transition: box-shadow .3s ease, background .3s ease;
}
.top-header.scrolled {
  box-shadow: 0 1px 12px rgba(0,0,0,.06);
  background: rgba(255,255,255,.96);
}

.header-inner {
  width: var(--max-w);
  max-width: 1800px;
  margin: 0 auto;
  padding: 0 var(--sp-6);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
}

/* Logo */
.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--c-text);
  letter-spacing: -0.02em;
  flex-shrink: 0;
  transition: var(--tr-s);
}
.header-logo:hover { opacity: 0.8; }
.header-logo .logo-icon {
  width: 32px; height: 32px;
  background: linear-gradient(135deg, var(--c-primary) 0%, #1e40af 100%);
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(37,99,235,.25);
}

/* Desktop Nav */
.desktop-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}
.nav-link {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--c-text-3);
  transition: var(--tr);
  white-space: nowrap;
  position: relative;
}
.nav-link:hover {
  color: var(--c-primary);
  background: var(--c-primary-xl);
}
.nav-link.active {
  color: var(--c-primary);
  background: var(--c-primary-l);
  font-weight: 600;
}
.nav-link .nav-icon {
  font-size: 16px;
  line-height: 1;
}

/* Header Right */
.header-right {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-shrink: 0;
  margin-left: auto;
}

/* ── HAMBURGER BUTTON (mobile only) ── */
.hamburger-btn {
  display: none;
  width: 40px; height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--c-text-2);
  transition: var(--tr);
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger-btn:hover { background: var(--c-surface-2); }
.hamburger-btn:active { transform: scale(.95); }
.hamburger-btn svg { width: 22px; height: 22px; }

/* ── DRAWER OVERLAY + PANEL ── */
.drawer-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 2000;
  opacity: 0;
  transition: opacity .3s cubic-bezier(.4,0,.2,1);
}
.drawer-overlay.open {
  display: block;
  opacity: 1;
}

.drawer {
  position: fixed;
  top: 0;
  right: -320px;
  width: 300px;
  max-width: 85vw;
  height: 100vh;
  height: 100dvh;
  background: var(--c-surface);
  z-index: 2001;
  transition: right .35s cubic-bezier(.32,.72,0,1);
  display: flex;
  flex-direction: column;
  box-shadow: -12px 0 40px rgba(0,0,0,.12);
  overflow: hidden;
  border-radius: var(--r-xl) 0 0 var(--r-xl);
}
.drawer.open {
  right: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--sp-5) var(--sp-5);
  border-bottom: 1px solid var(--c-border);
  flex-shrink: 0;
}
.drawer-header .drawer-title {
  font-weight: 700;
  font-size: var(--fs-md);
  color: var(--c-text);
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.drawer-close {
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-md);
  color: var(--c-text-3);
  transition: var(--tr);
}
.drawer-close:hover { background: var(--c-surface-2); color: var(--c-text); }
.drawer-close:active { transform: scale(.9); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) 0;
}

/* Drawer nav items */
.drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0 var(--sp-3);
}
.drawer-nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  font-weight: 500;
  color: var(--c-text-2);
  transition: var(--tr);
}
.drawer-nav-link:hover {
  background: var(--c-surface-2);
  color: var(--c-primary);
}
.drawer-nav-link.active {
  background: var(--c-primary-xl);
  color: var(--c-primary);
  font-weight: 700;
}
.drawer-nav-link .drawer-icon {
  font-size: 20px;
  line-height: 1;
  width: 28px;
  text-align: center;
}
.drawer-nav-link .drawer-label {
  flex: 1;
}

.drawer-divider {
  height: 1px;
  background: var(--c-border);
  margin: var(--sp-3) var(--sp-5);
}

/* Drawer footer (auth + lang) */
.drawer-footer {
  padding: var(--sp-5);
  border-top: 1px solid var(--c-border);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  background: var(--c-surface-3, #F8FAFC);
}
.drawer-auth-row {
  display: flex;
  gap: var(--sp-2);
  width: 100%;
}
.drawer-auth-btn,
.drawer-signup-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 13px var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--fs-sm);
  font-weight: 600;
  transition: var(--tr);
  flex: 1;
}
.drawer-login-btn {
  background: #fff;
  color: var(--c-text);
  border: 1.5px solid var(--c-border);
}
.drawer-login-btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.drawer-signup-btn {
  background: linear-gradient(135deg, var(--c-primary), #1D4ED8);
  color: #fff;
  border: none;
  font-weight: 700;
  box-shadow: var(--sh-primary);
}
.drawer-signup-btn:hover { box-shadow: var(--sh-primary-lg); }
.drawer-auth-btn.logged-in {
  background: linear-gradient(135deg,#10B981,#059669);
  color: #fff;
  border: none;
  flex: 1;
  box-shadow: 0 4px 14px rgba(5,150,105,.25);
}
.drawer-lang-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.drawer-lang-label {
  font-size: var(--fs-xs);
  color: var(--c-text-4);
}

/* Language Dropdown */
.lang-toggle-wrapper {
  position: relative;
}
.lang-toggle {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px var(--sp-3);
  border-radius: var(--r-full);
  font-size: var(--fs-xs);
  font-weight: 600;
  color: var(--c-text-3);
  background: var(--c-surface-2);
  transition: var(--tr);
  cursor: pointer;
}
.lang-toggle:hover { background: var(--c-border); }
.lang-code { margin: 0 2px; }
.lang-arrow {
  font-size: 9px;
  color: var(--c-text-4);
  margin-left: 1px;
  transition: transform .2s ease;
}

.lang-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 220px;
  max-height: 340px;
  overflow-y: auto;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-xl);
  z-index: 2010;
  padding: var(--sp-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
}
.lang-dropdown.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.lang-option {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  width: 100%;
  padding: 10px var(--sp-3);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  color: var(--c-text-2);
  transition: background .15s ease;
  cursor: pointer;
  text-align: left;
}
.lang-option:hover {
  background: var(--c-surface-2);
}
.lang-option.active {
  color: var(--c-primary);
  font-weight: 600;
  background: var(--c-primary-xl);
}
.lang-option-flag {
  font-size: 17px;
  line-height: 1;
  flex-shrink: 0;
}
.lang-option-name { flex: 1; }
.lang-check {
  color: var(--c-primary);
  font-weight: 700;
  font-size: var(--fs-xs);
}

/* Auth Button */
.auth-btn {
  padding: 7px var(--sp-4);
  border-radius: var(--r-full);
  font-size: var(--fs-sm);
  font-weight: 600;
  background: var(--c-primary);
  color: #fff;
  transition: var(--tr);
}
.auth-btn:hover { background: var(--c-primary-h); transform: translateY(-1px); }
.auth-btn:active { transform: translateY(0); }

/* ── OLD MOBILE BOTTOM NAV (now replaced by drawer) ── */
.mobile-nav {
  display: none !important;
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .desktop-nav { display: none; }
  .hamburger-btn { display: flex !important; }
  .header-inner { padding: 0 var(--sp-4); gap: var(--sp-3); }
  .header-logo { font-size: 0.95rem; }
  .header-logo .logo-icon { width: 28px; height: 28px; font-size: 12px; }

  /* 모바일에서 헤더 auth 버튼 숨기고 drawer에서 처리 */
  .header-right .auth-btn { display: none; }
  .header-right .lang-toggle-wrapper { display: none; }
}

@media (min-width: 769px) {
  .hamburger-btn { display: none !important; }
  #ciOverlay, #ciDrawer { display: none !important; }
  .drawer-overlay, .drawer { display: none !important; }
}

/* ── FOOTER ── */
.site-footer {
  background: #0F172A;
  color: rgba(255,255,255,.5);
  padding: var(--sp-12) var(--sp-6) var(--sp-10);
  font-size: var(--fs-xs);
}
.footer-inner {
  width: var(--max-w);
  max-width: 1800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 16px;
}
.footer-business-info {
  font-size: 0.82rem;
  line-height: 1.8;
  color: rgba(255,255,255,.5);
}
.footer-business-info strong {
  color: rgba(255,255,255,.75);
}
.footer-links {
  display: flex;
  gap: var(--sp-5);
}
.footer-links a {
  color: rgba(255,255,255,.45);
  transition: var(--tr-s);
  font-weight: 500;
}
.footer-links a:hover { color: rgba(255,255,255,.85); }
.footer-copyright {
  color: rgba(255,255,255,.3);
  font-size: 0.75rem;
}

@media (max-width: 768px) {
  .site-footer { padding: var(--sp-10) var(--sp-4) var(--sp-8); }
  .footer-links { gap: var(--sp-4); }
}
