:root {
  /* =========================================
     1. Design Tokens (Dark Theme)
     ========================================= */
  --bg-dark: #0f172a;
  --bg-card: #1e293b;
  --text-main: #f8fafc;
  --text-sub: #94a3b8;
    --border-light: rgba(255, 255, 255, 0.1);
    --brand: #a435f0;
}

/* =========================================
   3. Global Layout & Reset Overrides
   ========================================= */
body { padding-top: 60px; }

/* =========================================
   4. Navbar: Liquid Glass Effect
   ========================================= */
.topbar { 
  position: fixed; top: 0; left: 0; right: 0; width: 100%; z-index: 1000; 
  /* Translucent for Glass Effect */
  background: rgba(15, 23, 42, 0.70); 
  /* Strong Blur */
  backdrop-filter: blur(20px) saturate(180%); 
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  
  border-bottom: 1px solid rgba(255, 255, 255, 0.04); 
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  color: var(--text-main);
}

/* Light-background variant */
.topbar.on-light {
  background: rgba(255, 255, 255, 0.75);
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  color: #0f172a;
}
.topbar.on-light .logo,
.topbar.on-light #yooox2006ExploreBtn,
.topbar.on-light #exploreBtn,
.topbar.on-light .btn,
.topbar.on-light .search-toggle {
  color: #0f172a;
}
.topbar.on-light .btn {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.12);
}
.topbar.on-light .btn:hover {
  background: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
.topbar.on-light .search {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.12);
}
.topbar.on-light .search input { color: #0f172a; }
.topbar.on-light .search input::placeholder { color: #64748b; }
.topbar.on-light .explore-panel,
.topbar.on-light .submenu,
.topbar.on-light .user-menu-panel,
.topbar.on-light .gtranslate-popup {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(15, 23, 42, 0.08);
  color: #0f172a;
}
.topbar.on-light .explore-menu-item > a,
.topbar.on-light .submenu a,
.topbar.on-light .user-menu-panel a {
  color: #0f172a;
}
.topbar.on-light .explore-menu-item > a,
.topbar.on-light .submenu a,
.topbar.on-light .user-menu-panel a {
  border-bottom-color: rgba(15, 23, 42, 0.08);
}
.topbar.on-light .explore-menu-item > a:hover,
.topbar.on-light .submenu a:hover,
.topbar.on-light .user-menu-panel a:hover {
  background: rgba(15, 23, 42, 0.06) !important;
  color: #0f172a;
}
.topbar.on-light .submenu-caret { color: #64748b; }

.topbar.on-light #navLoginBtn,
.topbar.on-light .translate-switcher .btn {
  background: transparent;
  border-color: transparent;
}
.topbar.on-light #navLoginBtn:hover,
.topbar.on-light .translate-switcher .btn:hover {
  background: transparent;
  border-color: transparent;
}
.topbar.on-light .user-menu .btn {
  background: transparent;
  border-color: transparent;
}
.topbar.on-light .user-menu .btn:hover {
  background: transparent;
  border-color: transparent;
}

.topbar .container { max-width: 1200px; margin: 0 auto; padding: 0 18px; }
.topbar-inner { display: flex; align-items: center; height: 60px; gap: 14px; flex-wrap: nowrap; }

.logo { display: flex; align-items: center; gap: 8px; font-weight: 900; letter-spacing: -0.5px; color: var(--text-main); text-decoration: none; }
.logo:hover { color: var(--text-main); text-decoration: none; }
.logo-mark { width: 22px; height: 22px; border-radius: 5px; background: linear-gradient(135deg, var(--brand), #ff7b00); }
.logo img { max-height: 26px; width: auto; display: block; }
.logo > div { font-size: 14px; }

/* =========================================
   5. Dropdowns & Menus (Dark Styed)
   ========================================= */
.explore-menu { position: relative; flex-shrink: 0; }
#yooox2006ExploreBtn, #exploreBtn { display: flex; align-items: center; gap: 6px; font-weight: 500; padding: 8px 12px; cursor: pointer; color: var(--text-main); transition: 0.2s; border-radius: 6px; }
#yooox2006ExploreBtn:hover, #exploreBtn:hover { background: rgba(255,255,255,0.05); color: #fff; text-decoration: none; }
.explore-caret { font-size: 8px; margin-left: -2px; }
#yooox2006ExploreBtn svg,
#exploreBtn svg {
  transition: transform 0.2s ease;
}
.explore-caret {
  display: inline-block;
  transition: transform 0.2s ease;
}
#yooox2006ExploreBtn.is-open svg,
#exploreBtn.is-open svg {
  transform: rotate(90deg);
}
#yooox2006ExploreBtn.is-open .explore-caret,
#exploreBtn.is-open .explore-caret {
  transform: rotate(180deg);
}

.explore-panel, .submenu, .user-menu-panel, .gtranslate-popup { 
  display: none; position: absolute; background: var(--bg-card); 
  border: 1px solid var(--border-light); 
  box-shadow: none; 
  z-index: 1001; 
  border-radius: 8px;
  color: var(--text-main);
}
/* Ensure links inside menus don't inherit global hover color */
.explore-panel a:hover, .submenu a:hover, .user-menu-panel a:hover { color: #fff; }

.explore-panel { top: 100%; left: 0; margin-top: 4px; min-width: 260px; max-width: 400px; height: auto; max-height: calc(100vh - 120px); overflow-y: auto; overflow-x: visible; padding: 4px 0; }
.submenu { position: fixed; min-width: 220px; overflow-y: auto; height: auto; max-height: calc(100vh - 120px); padding: 4px 0; }
.user-menu-panel, .gtranslate-popup { top: 100%; right: 0; margin-top: 8px; min-width: 180px; padding: 0 !important; overflow: hidden; }
.gtranslate-popup { padding: 12px !important; }
.translate-switcher .gtranslate-popup { display: none !important; }
.translate-switcher.is-open .gtranslate-popup { display: block !important; }

/* Menu Items */
.explore-menu-item > a, .submenu a, .user-menu-panel a { 
  display: flex; align-items: center; justify-content: space-between; 
  padding: 10px 16px; color: var(--text-main); 
  text-decoration: none; transition: all .15s; 
  font-weight: 400; font-size: 14px; 
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.explore-menu-item:last-child > a,
.submenu li:last-child a,
.submenu a:last-child,
.user-menu-panel a:last-child {
  border-bottom: 0;
}
.explore-menu-item > a:hover, .submenu a:hover, .user-menu-panel a:hover { 
  background: rgba(255,255,255,0.05) !important; color: #fff; 
}
.submenu-caret { font-size: 14px; color: var(--text-sub); margin-left: 8px; }

/* Search */
.search { 
  flex: 1 1 280px; display: none; align-items: center; gap: 10px; 
  border: 1px solid var(--border-light); 
  background: rgba(255,255,255,0.05); 
  padding: 0 12px; border-radius: 999px; 
  min-width: 160px; max-width: 100%; width: min(520px, 100%); 
  height: 35px; margin-left: auto; 
  transition: 0.2s;
}
.search.active { display: flex; animation: topbar-search-reveal 0.18s ease-out; }
.search:focus-within { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.2); }
.search form { display: flex; align-items: center; gap: 10px; width: 100%; height: 100%; }
.search input { border: 0; outline: 0; background: transparent; width: 100%; font-size: 14px; height: 100%; color: var(--text-main); }
.search input::placeholder { color: var(--text-sub); }
.search-toggle { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border: 0; color: var(--text-main); text-decoration: none; background: transparent; margin-left: auto; }

/* Actions */
.top-actions { display: flex; align-items: center; gap: 10px; }
.btn { 
  border: 1px solid var(--border-light); 
  background: rgba(255,255,255,0.05); 
  padding: 8px 16px; border-radius: 999px; 
  font-weight: 500; font-size: 14px; cursor: pointer; 
  color: var(--text-main); text-decoration: none; 
  display: inline-flex; align-items: center; justify-content: center; 
  transition: all 0.2s; 
}
.theme-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.theme-toggle .theme-icon {
  line-height: 1;
  display: none;
}
.theme-toggle svg {
  display: block;
}
body.theme-dark .theme-toggle .theme-icon-sun { display: inline; }
body.theme-light .theme-toggle .theme-icon-moon { display: inline; }
.btn:hover { background: rgba(255,255,255,0.15); text-decoration: none; color: #fff; }
.btn svg, .btn img { margin-right: 0; }

/* Icon-only actions: no background pill */
#navLoginBtn,
.translate-switcher .btn {
  background: transparent;
  border-color: transparent;
  padding: 8px 10px;
}
#navLoginBtn:hover,
.translate-switcher .btn:hover {
  background: transparent;
  border-color: transparent;
}
.user-menu .btn {
  background: transparent;
  border-color: transparent;
  padding: 8px 10px;
}
.user-menu .btn:hover {
  background: transparent;
  border-color: transparent;
}

.user-menu { position: relative; }
.user-menu-panel a.danger { color: #ef4444; }
.user-menu-panel a.danger:hover { background: rgba(239, 68, 68, 0.1) !important; }

/* =========================================
   6. Responsive
   ========================================= */
@keyframes topbar-search-reveal {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  body.home .topbar {
    background: rgba(15, 23, 42, 0.70);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom-color: rgba(255, 255, 255, 0.08);
  }
  body.home .topbar.on-light {
    background: rgba(15, 23, 42, 0.70);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
  }
  body { padding-top: 68px; }
  .topbar-inner { height: auto; gap: 10px; padding: 10px 0; flex-wrap: nowrap; }
  .search { display: none; order: 3; flex: 1 1 auto; min-width: 0; height: 40px; margin-left: auto; }
  .search.active { display: flex; animation: topbar-search-reveal 0.18s ease-out; }
  .search-toggle { order: 3; display: inline-flex; margin-left: auto; }
  .top-actions { order: 4; gap: 8px; flex-wrap: nowrap; flex-shrink: 0; }
  .btn { padding: 8px 10px; font-size: 13px; white-space: nowrap; }
}

@media (max-width: 480px) {
  body { padding-top: 64px; }
  .topbar-inner { padding: 8px 0; position: relative; }
  .search { 
    display: none; position: absolute; top: 100%; left: 0; right: 0; 
    background: var(--bg-card); 
    border-top: 1px solid var(--border-light); 
    padding: 10px 18px; z-index: 1000; margin-left: 0; 
  }
  .search.active { display: flex; animation: topbar-search-reveal 0.18s ease-out; }
  .search-toggle { display: inline-flex; }
  .btn { padding: 7px 9px; font-size: 12px; }
}
