/* =========================================================
   SHIFT AUTO SUPPLY — Layout
   Header, Footer, Navigation, Drawers
   ========================================================= */

/* ─── Announcement Bar ──────────────────────────────────── */
.announcement-bar {
  background: var(--neutral-900);
  color: var(--neutral-200);
  text-align: center;
  padding: 8px var(--space-5);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  position: relative;
  z-index: 200;
}
.announcement-bar strong { color: #fff; }
.announcement-bar a { color: var(--blue-light); text-decoration: underline; }
[data-theme="dark"] .announcement-bar { background: var(--blue-dark); }

/* ─── Header ────────────────────────────────────────────── */
.header {
  position: sticky;
  top: 0;
  z-index: 150;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: all var(--transition-base);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: var(--header-height);
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: 0 var(--space-5);
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}
.site-logo-mark {
  width: 36px;
  height: 36px;
  background: var(--blue);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.site-logo-mark::after {
  content: '';
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  background: var(--crimson);
  border-radius: 3px;
}
.site-logo-mark svg { position: relative; z-index: 1; color: #fff; }
.site-logo-name {
  display: flex;
  flex-direction: column;
  line-height: 1;
}
.site-logo-name .brand { font-family: var(--font-head); font-size: 17px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.02em; }
.site-logo-name .tagline { font-size: 10px; font-weight: 500; color: var(--text-muted); letter-spacing: 0.08em; text-transform: uppercase; margin-top: 2px; }

/* Header search */
.header-search {
  flex: 1;
  max-width: 520px;
  position: relative;
}
.header-search input {
  width: 100%;
  height: 40px;
  padding: 0 44px 0 16px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 14px;
  color: var(--text-primary);
  transition: all var(--transition-fast);
  outline: none;
}
.header-search input:focus {
  border-color: var(--blue);
  background: var(--bg-card);
  box-shadow: var(--shadow-blue);
}
.header-search input::placeholder { color: var(--text-muted); }
.header-search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius-full);
  transition: background var(--transition-fast);
}
.header-search-btn:hover { background: var(--blue-dark); }

/* Header actions */
.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.header-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  position: relative;
}
.header-btn:hover { color: var(--text-primary); background: var(--bg-elevated); }
.header-btn.active { color: var(--blue); }

.header-btn-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: auto;
  padding: 0 var(--space-3);
}
.header-btn-label span { font-size: 11px; font-weight: 500; color: var(--text-muted); margin-top: 2px; }

/* Cart badge */
.cart-badge {
  position: absolute;
  top: 2px; right: 2px;
  min-width: 18px; height: 18px;
  padding: 0 4px;
  background: var(--crimson);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  pointer-events: none;
  transform: scale(0);
  transition: transform var(--transition-fast);
}
.cart-badge.visible { transform: scale(1); }

/* Dark mode toggle */
.theme-toggle {
  position: relative;
  width: 44px; height: 24px;
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: background var(--transition-fast);
  flex-shrink: 0;
}
.theme-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  background: var(--text-secondary);
  border-radius: 50%;
  transition: transform var(--transition-fast), background var(--transition-fast);
}
[data-theme="dark"] .theme-toggle { background: var(--blue-50); border-color: var(--blue); }
[data-theme="dark"] .theme-toggle::after { transform: translateX(20px); background: var(--blue); }

/* ─── Navigation ────────────────────────────────────────── */
.nav {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 999;
  overflow: visible;
  isolation: isolate;
}

.nav-inner {
  display: flex;
  align-items: center;
  gap: 0;
  max-width: var(--container-lg);
  margin: 0 auto;
  padding: 0 var(--space-5);
  overflow: visible;
  -ms-overflow-style: none;
  scrollbar-width: none;
  white-space: nowrap;
}
.nav-inner::-webkit-scrollbar { display: none; }

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 12px var(--space-4);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  transition: all var(--transition-fast);
  text-decoration: none;
}
.nav-link:hover { color: var(--text-primary); }
.nav-link.active { color: var(--blue); border-bottom-color: var(--blue); }
.nav-link svg { width: 15px; height: 15px; }
.nav-link .badge { margin-left: 4px; }

/* Mega dropdown */
.nav-dropdown { position: relative; }
.nav-dropdown:hover .dropdown-menu { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  padding: var(--space-2);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-base);
  z-index: 9999;
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-3);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.dropdown-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.dropdown-item svg { width: 16px; height: 16px; color: var(--blue); flex-shrink: 0; }

/* ─── Mobile Header ─────────────────────────────────────── */
.mobile-nav-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}
.mobile-nav-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }

@media (max-width: 768px) {
  .mobile-nav-btn { display: flex; }
  .header-search { display: none; }
  .nav { display: none; }
  .header-btn-label span { display: none; }
}

/* ─── Slide Drawer ──────────────────────────────────────── */
.drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 300;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}
.drawer-overlay.active { opacity: 1; visibility: visible; }

.drawer {
  position: fixed;
  top: 0; bottom: 0; right: 0;
  width: min(380px, 92vw);
  background: var(--bg-card);
  box-shadow: var(--shadow-xl);
  z-index: 310;
  transform: translateX(100%);
  transition: transform var(--transition-slow) cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.drawer.left { right: auto; left: 0; transform: translateX(-100%); }
.drawer.active { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.drawer-header h3 { font-size: 18px; font-weight: 700; }
.drawer-close {
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  transition: all var(--transition-fast);
}
.drawer-close:hover { background: var(--bg-elevated); color: var(--text-primary); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6);
}
.drawer-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}

/* Mobile search drawer */
.mobile-search-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  border-bottom: 1px solid var(--border);
}
.mobile-search-bar input {
  flex: 1;
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--bg-elevated);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-full);
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
}
.mobile-search-bar input:focus { border-color: var(--blue); }

/* ─── Footer ─────────────────────────────────────────────── */
.footer {
  background: var(--neutral-900);
  color: var(--neutral-400);
  padding: var(--space-20) 0 0;
  margin-top: var(--space-20);
}
[data-theme="dark"] .footer { background: #080C14; }

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: var(--space-12);
  padding-bottom: var(--space-16);
}
.footer-brand .brand-name {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: var(--space-3);
}
.footer-brand p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--neutral-400);
  margin-bottom: var(--space-6);
  max-width: 280px;
}
.footer-badges {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.footer-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  color: var(--neutral-300);
}
.footer-badge svg { width: 13px; height: 13px; color: var(--blue-light); }

.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: var(--space-5);
}
.footer-col ul { display: flex; flex-direction: column; gap: var(--space-3); }
.footer-col ul li a {
  font-size: 14px;
  color: var(--neutral-400);
  transition: color var(--transition-fast);
}
.footer-col ul li a:hover { color: #fff; }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: var(--space-6) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
}
.footer-bottom p { font-size: 13px; }
.footer-bottom-links {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.footer-bottom-links a { font-size: 13px; color: var(--neutral-400); transition: color var(--transition-fast); }
.footer-bottom-links a:hover { color: #fff; }

/* ─── Sticky Mobile Cart ─────────────────────────────────── */
.sticky-cart-bar {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 200;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-5);
  box-shadow: 0 -4px 20px rgba(0,0,0,.1);
}
.sticky-cart-bar .btn { width: 100%; }

@media (max-width: 768px) {
  .sticky-cart-bar { display: flex; gap: var(--space-3); }
  .footer-grid { grid-template-columns: 1fr 1fr; gap: var(--space-8); }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
}

/* ─── Floating Support Button ────────────────────────────── */
.float-support {
  position: fixed;
  bottom: 80px;
  right: var(--space-5);
  z-index: 190;
  width: 48px; height: 48px;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,102,204,0.4);
  transition: all var(--transition-fast);
}
.float-support:hover { background: var(--blue-dark); transform: scale(1.08); }
@media (min-width: 769px) { .float-support { bottom: var(--space-8); } }

/* ─── Toast Notifications ────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: var(--space-6);
  right: var(--space-6);
  z-index: 500;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}
@media (max-width: 768px) {
  .toast-container { bottom: 80px; right: var(--space-4); left: var(--space-4); }
}
.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  animation: slideUp 0.3s ease both;
  max-width: 360px;
}
.toast.success { border-left: 3px solid #22C55E; }
.toast.error   { border-left: 3px solid var(--crimson); }
.toast.info    { border-left: 3px solid var(--blue); }
.toast-icon { flex-shrink: 0; }
.toast.success .toast-icon { color: #22C55E; }
.toast.error   .toast-icon { color: var(--crimson); }
.toast.info    .toast-icon { color: var(--blue); }
.toast-close { margin-left: auto; color: var(--text-muted); cursor: pointer; }
.toast-close:hover { color: var(--text-primary); }
.toast.exit { animation: slideDown 0.2s ease both; opacity: 0; }

/* =========================================================
   LAYOUT RESPONSIVE FIXES
   ========================================================= */

/* Nav scroll on mobile */

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px var(--space-4);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.nav-link:hover, .nav-link.active { color: var(--text-primary); }
.nav-link.active { color: var(--blue); }

/* Header search — hide on small screens */
@media (max-width: 768px) {
  .header-search { display: none; }
}
@media (max-width: 480px) {
  .header-inner { gap: var(--space-3); padding: 0 var(--space-4); }
  .header-btn { width: 36px; height: 36px; }
  .site-logo-name .tagline { display: none; }
}

/* Mobile nav button — show only on mobile */
.mobile-nav-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.mobile-nav-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }
@media (max-width: 768px) {
  .mobile-nav-btn { display: flex; }
}

/* Footer responsive */
@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-8);
  }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; gap: var(--space-3); text-align: center; }
  .footer-bottom-links { flex-wrap: wrap; justify-content: center; }
}

/* Sticky cart bar — proper z-index and safe area */
.sticky-cart-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  z-index: 200;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  padding-bottom: max(var(--space-3), env(safe-area-inset-bottom));
  display: flex;
  gap: var(--space-3);
  align-items: center;
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}

/* Announcement bar responsive */
@media (max-width: 480px) {
  .announcement-bar { font-size: 11px; padding: 6px var(--space-8) 6px var(--space-4); }
}

/* Float support button — safe area */
.float-support {
  position: fixed;
  bottom: max(80px, calc(72px + env(safe-area-inset-bottom)));
  right: var(--space-5);
  z-index: 190;
  width: 48px; height: 48px;
  background: var(--blue);
  color: #fff;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-lg);
  transition: all var(--transition-fast);
}
.float-support:hover { background: var(--blue-dark); transform: scale(1.05); }

/* Drawers — ensure they never exceed viewport */
.drawer {
  max-width: min(420px, 94vw);
}
.drawer.left {
  max-width: min(320px, 94vw);
}

/* Section spacing fix on mobile */
@media (max-width: 768px) {
  .section { padding: var(--space-12) 0; }
  .section-sm { padding: var(--space-8) 0; }
}
