/* 
   Global Theme System - v2.1
   Handles both Public and Admin variable dialects.
   Ensures section backgrounds, navbars, and ratings work out-of-the-box.
*/

:root {
  /* Default variables if not defined in page */
  --primary-blue: #0b1a30;
  --accent-orange: #f28b00;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --nav-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shared-top-bar-height: 24px;
}

/* DARK MODE OVERRIDES */
:root[data-theme="dark"] {
  color-scheme: dark;
  
  /* Public Dialect */
  --bg-light: #000000;
  --text-dark: #f8fafc;
  --text-muted: #e2e8f0;
  --border-color: rgba(255, 255, 255, 0.1);
  --white: #000000;
  --primary-blue: #38bdf8;
  --accent-orange: #fb923c;
  --card-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  --nav-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);

  /* Admin Dialect */
  --bg: #000000;
  --card: #0a0a0a;
  --border: rgba(255, 255, 255, 0.1);
  --text: #f8fafc;
  --muted: #e2e8f0;
  --accent: #38bdf8;
  --accent-hover: #7dd3fc;
  --nav-bg: #0a0a0a;
  --input-bg: #111111;
  --shadow: 0 4px 30px rgba(0, 0, 0, 0.6);
}

/* LIGHT MODE OVERRIDES */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-light: #f4f6f9;
  --text-dark: #1a1a1a;
  --text-muted: #6c757d;
  --border-color: #eef0f4;
  --white: #ffffff;
  --primary-blue: #0b1a30;
  --accent-orange: #f28b00;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
  --nav-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  
  /* Admin Dialect */
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #4f46e5;
  --accent-hover: #4338ca;
  --nav-bg: #ffffff;
  --input-bg: #ffffff;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

/* Functional Overrides for Dark Mode */
[data-theme="dark"] body {
  background-color: var(--bg-light) !important;
}

[data-theme="dark"] .section.white {
  background-color: var(--bg-light) !important;
}

[data-theme="dark"] .navbar, 
[data-theme="dark"] .navbar-admin,
[data-theme="dark"] .drawer,
[data-theme="dark"] .card,
[data-theme="dark"] .restaurant-card,
[data-theme="dark"] .location-card,
[data-theme="dark"] .reservation-card,
[data-theme="dark"] .search-bar,
[data-theme="dark"] .review-card,
[data-theme="dark"] .modal-content,
[data-theme="dark"] .footer,
[data-theme="dark"] .layout,
[data-theme="dark"] .sidebar,
[data-theme="dark"] .hist-item {
  background-color: var(--white) !important;
  border-color: var(--border-color) !important;
  box-shadow: var(--card-shadow) !important;
  color: var(--text-dark) !important;
}

[data-theme="dark"] .footer {
    background-color: #000000 !important; /* Pure black for footer */
}

/* Specific fix for rating badges in dark mode */
[data-theme="dark"] .rating,
[data-theme="dark"] .card-pill {
  background-color: #1a1a1a !important; /* Dark neutral for rating */
  color: #ffffff !important;
}

[data-theme="dark"] input, 
[data-theme="dark"] select, 
[data-theme="dark"] textarea {
  background-color: rgba(255,255,255,0.05) !important;
  color: var(--text-dark) !important;
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .search-field {
  border-color: var(--border-color) !important;
}

[data-theme="dark"] .arrow-btn {
    background-color: var(--white) !important;
    border-color: var(--border-color) !important;
    color: var(--text-dark) !important;
}

[data-theme="dark"] .view-all,
[data-theme="dark"] .nav-links a {
    color: var(--text-muted) !important;
}

[data-theme="dark"] .nav-links a:hover,
[data-theme="dark"] .nav-links a.active {
    color: var(--accent-orange) !important;
}

[data-theme="dark"] .drawer-link {
    color: var(--text-muted) !important;
}
[data-theme="dark"] .drawer-link:hover,
[data-theme="dark"] .drawer-link.active {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .drawer-close {
    background-color: rgba(255, 255, 255, 0.05) !important;
    color: var(--text-muted) !important;
}
[data-theme="dark"] .drawer-close:hover {
    background-color: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}
[data-theme="dark"] .drawer-footer {
    border-top-color: var(--border-color) !important;
}

/* Logo Switching */
.logo {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: auto !important;
    width: auto !important;
    max-width: min(320px, 58vw) !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    flex-shrink: 0;
}

[data-theme="dark"] .logo {
    max-width: min(320px, 58vw) !important;
}

[data-theme="dark"] .navbar-scrolled .logo {
    max-width: min(320px, 58vw) !important;
}

.logo img.logo-light {
    height: auto !important;
    max-height: 56px !important;
    width: auto !important;
    max-width: min(300px, 72vw) !important;
    object-fit: contain !important;
}

/* Same visual footprint as light logo (dark asset often has padding — do not oversize) */
.logo img.logo-dark {
    height: auto !important;
    max-height: 52px !important;
    width: auto !important;
    max-width: min(240px, 68vw) !important;
    object-fit: contain !important;
    -webkit-clip-path: none;
    clip-path: none;
    display: none;
}

[data-theme="dark"] .logo img.logo-light {
    display: none !important;
}

[data-theme="dark"] .logo img.logo-dark {
    display: block !important;
    height: auto !important;
    max-height: 52px !important;
    width: auto !important;
    max-width: min(240px, 68vw) !important;
    object-fit: contain !important;
    -webkit-clip-path: none;
    clip-path: none;
}


/* Top Bar Styles */
.top-bar {
    background-color: #f8fafc;
    color: #64748b;
    font-size: 0.75rem;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 0.1rem 1.25rem;
    gap: 0.85rem;
    border-bottom: 1px solid #e2e8f0;
    position: relative;
    z-index: 10001;
    transition: all 0.3s ease;
    min-height: var(--shared-top-bar-height);
    height: var(--shared-top-bar-height);
    line-height: 1.2;
    box-sizing: border-box;
}

[data-theme="dark"] .top-bar {
    background-color: #0f172a;
    border-color: #1e293b;
    color: #94a3b8;
}

.top-bar-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    cursor: pointer;
    font-weight: 500;
    padding: 0;
    letter-spacing: 0.01em;
    font-size: 0.75rem;
}

.top-bar-item:hover {
    color: var(--primary-blue);
}

[data-theme="dark"] .top-bar-item:hover {
    color: #fff;
}

.top-bar-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    background: #fff;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    padding: 0.35rem 0;
    display: none;
    z-index: 1001;
    min-width: 150px;
    border: 1px solid #e2e8f0;
    margin-top: 0.25rem;
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

[data-theme="dark"] .top-bar-dropdown {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
}



.top-bar-dropdown a {
    display: block;
    padding: 0.45rem 0.9rem;
    color: #1e293b;
    text-decoration: none;
    font-size: 0.78rem;
    transition: all 0.2s;
}

[data-theme="dark"] .top-bar-dropdown a {
    color: #f1f5f9;
}

.top-bar-dropdown a:hover {
    background-color: #f1f5f9;
    color: var(--primary-blue);
}

[data-theme="dark"] .top-bar-dropdown a:hover {
    background-color: #334155;
    color: #fff;
}

/* Premium Shared Navbar */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 5%;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.navbar-scrolled {
    padding: 0.8rem 5%;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .navbar {
    background: rgba(15, 23, 42, 0.8);
    border-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .navbar-scrolled {
    background: rgba(15, 23, 42, 0.95);
}

.logo img {
    height: auto;
    max-height: 56px;
    width: auto;
    max-width: min(300px, 72vw);
    object-fit: contain;
    transition: max-height 0.3s ease;
}

.navbar-scrolled .logo img.logo-light {
    max-height: 52px !important;
    max-width: min(280px, 70vw) !important;
}

.navbar-scrolled .logo img.logo-dark {
    max-height: 50px !important;
    max-width: min(228px, 66vw) !important;
    -webkit-clip-path: none;
    clip-path: none;
}

.navbar-scrolled .logo img {
    max-height: 48px;
}

.nav-links {
    display: flex;
    gap: 2.5rem;
}

.nav-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: #64748b;
    position: relative;
    padding: 0.5rem 0;
}

.nav-link:hover {
    color: var(--primary-blue);
}

.nav-link.active {
    color: var(--primary-blue);
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-blue);
    border-radius: 2px;
}

[data-theme="dark"] .nav-link {
    color: #94a3b8;
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    color: #fff;
}

[data-theme="dark"] .nav-link.active::after {
    background: #fff;
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.btn-signin {
    font-weight: 600;
    color: var(--primary-blue);
    font-size: 0.95rem;
}

.btn-join {
    background: var(--primary-blue);
    color: #fff;
    padding: 0.7rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 6px -1px rgba(11, 26, 48, 0.2);
    transition: all 0.3s ease;
}

.btn-join:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(11, 26, 48, 0.3);
}

/* Footer Styling */
.footer {
    background: transparent;
    padding: 0;
    margin: 0;
}

[data-theme="dark"] .footer {
    background: transparent;
}

.footer-grid {
    max-width: 1400px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 4rem;
    margin-bottom: 4rem;
}

.footer-bottom {
    max-width: 1400px;
    margin: 0 auto;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

[data-theme="dark"] .footer-bottom {
    border-color: #1e293b;
    color: #94a3b8;
}

/* Hamburger for Mobile */
.hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-blue);
}

[data-theme="dark"] .hamburger {
    color: #fff;
}

@media (max-width: 1024px) {
    .nav-links, .nav-actions {
        display: none;
    }
    .hamburger {
        display: block;
    }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
    }
}

@media (max-width: 640px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .top-bar {
        display: none; /* Hide top bar on mobile to save space */
    }
    /* Customer logged-in home: keep utility top bar visible */
    body[data-page-chrome="customer-home"] .top-bar {
        display: flex !important;
        flex-wrap: wrap;
        justify-content: center !important;
        min-height: var(--shared-top-bar-height, 24px);
        height: auto;
        padding: 0.15rem 0.65rem !important;
        gap: 0.55rem !important;
        font-size: 0.7rem !important;
    }
}
