:root {
  --color-bg: #ffffff;
  --color-fg: #111111;
  --color-accent: #1976d2;
  --color-hover: rgba(25, 118, 210, 0.1);

  --color-bg-dark: #181818;
  --color-fg-dark: #f1f1f1;

  --navbar-bg: #f8f9fa;
  --navbar-bg-dark: #101010;

  --color-hover-dark: rgba(255,255,255,0.08);
  --transition-fast: 0.3s ease;
  --icon-color: #222;
}

body.dark {
  background: var(--color-bg-dark);
  color: var(--color-fg-dark);
  --navbar-bg: var(--navbar-bg-dark);
  --icon-color: #fff;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Segoe UI', sans-serif;
  background: var(--color-bg);
  color: var(--color-fg);
  transition: background var(--transition-fast), color var(--transition-fast);
  overflow-x: hidden;
}

header {
  position: fixed !important;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  z-index: 9999;
  background-color: var(--navbar-bg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background-color 0.3s ease;
  backdrop-filter: blur(10px); /* always applied */
}

body {
  padding-top: 64px;
}




.logo img {
  height: 56px;
  padding-inline: 8px;
}

.desktop-search {
  flex: 1;
  max-width: 500px;
  margin: 0 24px;
  transition: all 0.3s ease-in-out;
}

.desktop-search input {
  width: 100%;
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid #ccc;
  font-size: 1rem;
}

.nav-links,
.auth-controls {
  display: flex;
  gap: 4px;
  align-items: center;
  position: relative;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  background: none;
  border: none;
}

.mobile-bar {
  display: none;
  gap: 12px;
}

.mobile-search-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 13000;

  opacity: 0;
  transform: translateY(-20px) scale(0.98);
  pointer-events: none;
  transition: 
    opacity 0.4s ease,
    transform 0.4s ease,
    backdrop-filter 0.4s ease;
}

body.dark .mobile-search-overlay {
  background: rgba(18, 18, 18, 0.95);
}

.mobile-search-overlay.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}


.mobile-search-box {
  position: relative;
  width: 80%;
}

.mobile-search-box input {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #ccc;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}

.mobile-search-box button {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 2rem;
  font-weight: bold;
  opacity: 0.6;
  cursor: pointer;
  color: #444;
  transition: opacity 0.2s, color 0.2s;
}

.mobile-search-box button:hover {
  opacity: 0.8;
  color: #000;
}

body.dark .mobile-search-box button {
  color: #444;
  opacity: 0.8;
}

body.dark .mobile-search-box button:hover {
  opacity: 0.95;
  color: #000;
}

.mobile-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 280px;
  height: 100dvh;
  background-color: var(--navbar-bg);
  box-shadow: -2px 0 16px rgba(0, 0, 0, 0.3);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.4s ease, visibility 0.4s ease, opacity 0.4s ease;
  z-index: 10001;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #999 transparent;
  border-radius: 1rem 0 0 1rem;

  transform: translateX(100%);
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  will-change: transform;
}

.mobile-drawer.show {
  transform: translateX(0);
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

body.dark .mobile-drawer {
  background-color: var(--navbar-bg-dark);
}

@media (max-width: 768px) {
  .mobile-drawer {
    width: 100% !important;
    border-radius: 0 !important;
  }
}


.drawer-section {
  margin-top: 24px;
}

.drawer-section h4 {
  margin: 24px 0 12px;
  font-size: 0.75rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drawer-section a,
.drawer-section button {
  background: none;
  border: none;
  color: inherit;
  text-align: left;
  font-size: 1.05rem;
  font-weight: 500;
  padding: 10px 12px;
  margin-bottom: 4px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.2s ease, color 0.2s ease;
  text-decoration: none;
}

.drawer-section a:hover,
.drawer-section button:hover {
  background: var(--color-hover);
  color: var(--color-accent);
}

.drawer-section a:active,
.drawer-section button:active {
  transform: scale(0.98);
}

body.dark .drawer-section h4 {
  color: #aaa;
}

.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1500;
}

.overlay.show {
  display: block;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}

@media (max-width: 1030px) {
  .desktop-search,
  .nav-links,
  .auth-controls {
    display: none !important;
  }

  .mobile-bar {
    display: flex;
  }
}

@media (min-width: 1031px) {
  .desktop-search,
  .nav-links,
  .auth-controls {
    display: flex;
  }

  .mobile-bar,
  #drawer,
  .overlay {
    display: none !important;
  }
}

.drawer-submenu {
  display: none;
  padding-left: 12px;
  margin-bottom: 8px;
  flex-direction: column;
}

.drawer-submenu.show {
  display: flex;
}

#drawerClose {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: inherit;
  cursor: pointer;
  padding: 8px;
  z-index: 10;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#drawerClose:hover {
  opacity: 0.8;
  color: var(--color-accent);
}

body.dark #drawerClose {
  color: #ccc;
}

body.dark #drawerClose:hover {
  color: #fff;
}

.brand-name {
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
}

body:not(.dark) .brand-name {
  color: #222;
}

html.drawer-open,
html.drawer-open.dark,
body.drawer-open,
body.drawer-open.dark {
  position: fixed;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

html, body {
  max-width: 100vw;             /* ✅ prevent horizontal scroll from drawer */
  overflow-x: hidden;           /* ✅ lock the page width */
}

.mobile-bar button {
  background: none;
  border: none;
  font-size: 6vw;           /* ✅ responsive icon size */
  width: 5vw;              /* ✅ responsive width */
  height: 5vw;             /* ✅ responsive height */
  color: var(--color-fg);   /* ✅ light mode color */
  cursor: pointer;
  transition: transform 0.2s ease, background-color 0.2s ease;
  border-radius: 0.5rem;
  min-width: 44px;          /* ✅ ensures good tap target */
  min-height: 44px;
  max-width: 70px;
  max-height: 70px;
  
}

body.dark .mobile-bar button {
  color: var(--color-fg-dark); /* ✅ dark mode support */
}

.mobile-bar button:hover {
  background-color: var(--color-hover); /* ✅ light hover effect */
  transform: scale(1.1);
}

body.dark .mobile-bar button:hover {
  background-color: var(--color-hover-dark); /* ✅ dark hover effect */
}

.mobile-bar button {
  vertical-align: middle;
  touch-action: manipulation;
}

.mobile-bar {
  justify-content: center;
  gap: 3vw; /* or use space-between */
}

@media (min-width: 500px) {
  .mobile-bar button {
    font-size: 32px; /* max cap */
  }
}