/* ============================================
   PUBLIC HEADER CSS
   Layout: Logo left (auto width) | Nav center (flex-grow) | Actions right (flex-shrink 0)
   Mobile: Menu slides from LEFT side
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #87BCD4;
    --primary-dark: #6ba3c0;
    --primary-light: #b8d9ec;
    --white: #ffffff;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-300: #dee2e6;
    --gray-500: #6c757d;
    --gray-600: #6c757d;
    --gray-700: #495057;
    --gray-800: #343a40;
    --gray-900: #212529;
    --dark-bg: #1a1a2e;
    --dark-surface: #16213e;
    --dark-border: #0f3460;
    --success: #28a745;
    --error: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --google-blue: #4285f4;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--white) 100%);
    min-height: 100vh;
    transition: background 0.3s ease, color 0.3s ease;
}

/* Dark Mode Base */
body.dark-mode {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    color: #e5e5e5;
}

/* ============================================
   NAVIGATION BAR
   ============================================ */
.navbar {
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(10px);
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 1000;
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

body.dark-mode .navbar {
    background: rgba(26, 26, 46, 0.98);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
}

body.dark-mode .navbar.scrolled {
    background: rgba(26, 26, 46, 0.98);
}

/* Nav Container - Flex layout */
.nav-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0.8rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

/* ============================================
   LEFT SECTION - Logo
   ============================================ */
.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.logo:hover {
    transform: scale(1.02);
}

.logo-img {
    height: 40px;
    width: 40px;
    object-fit: cover;
    border-radius: 50%;
}

.logo span {
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

body.dark-mode .logo span {
    color: var(--primary-light);
}

/* ============================================
   CENTER SECTION - Navigation Links
   Takes remaining space and centers links
   ============================================ */
.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.nav-links a {
    text-decoration: none;
    color: var(--gray-700);
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.5rem 0;
    position: relative;
}

body.dark-mode .nav-links a {
    color: #cbd5e1;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: width 0.3s ease;
    border-radius: 2px;
}

.nav-links a:hover::after,
.nav-links a.active::after {
    width: 100%;
}

.nav-links a:hover {
    color: var(--primary-color);
}

body.dark-mode .nav-links a:hover {
    color: var(--primary-light);
}

/* ============================================
   RIGHT SECTION - Actions
   Fixed width, never shrinks
   ============================================ */
.header-right {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-shrink: 0;
}

/* Language Selector */
.lang-selector {
    position: relative;
}

.lang-btn {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 0.5rem 0.9rem;
    border-radius: 30px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--gray-700);
    transition: all 0.3s;
}

body.dark-mode .lang-btn {
    background: var(--dark-surface);
    border-color: var(--dark-border);
    color: #cbd5e1;
}

.lang-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.lang-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 140px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s;
    z-index: 100;
}

body.dark-mode .lang-dropdown {
    background: var(--dark-surface);
    border: 1px solid var(--dark-border);
}

.lang-dropdown.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-dropdown a {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.7rem 1rem;
    text-decoration: none;
    color: var(--gray-700);
    transition: all 0.3s;
    font-size: 0.85rem;
}

body.dark-mode .lang-dropdown a {
    color: #cbd5e1;
}

.lang-dropdown a:hover {
    background: var(--gray-100);
}

body.dark-mode .lang-dropdown a:hover {
    background: rgba(135, 188, 212, 0.1);
}

.lang-dropdown a.active {
    background: var(--primary-color);
    color: white;
}

/* Theme Toggle Button */
.theme-toggle {
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    padding: 0.5rem;
    border-radius: 50%;
    cursor: pointer;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: var(--gray-700);
}

body.dark-mode .theme-toggle {
    background: var(--dark-surface);
    border-color: var(--dark-border);
    color: #cbd5e1;
}

.theme-toggle:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

/* Desktop Navigation Buttons */
.nav-buttons {
    display: flex;
    gap: 0.8rem;
}

.nav-btn-login,
.nav-btn-register {
    padding: 0.5rem 1.5rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-btn-login {
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    background: transparent;
}

.nav-btn-login:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(135, 188, 212, 0.3);
}

.nav-btn-register {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.nav-btn-register:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(135, 188, 212, 0.4);
}

/* ============================================
   MOBILE MENU BUTTON - Visible on mobile/tablet
   ============================================ */
.menu-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--primary-color);
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s;
    z-index: 1001;
}

.menu-toggle:hover {
    background: rgba(135, 188, 212, 0.1);
    transform: scale(1.05);
}

/* ============================================
   MOBILE MENU - SLIDES FROM LEFT SIDE
   ============================================ */
.mobile-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background: white;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.15);
    z-index: 1002;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    visibility: visible;
}

body.dark-mode .mobile-menu {
    background: var(--dark-surface);
}

.mobile-menu.show {
    transform: translateX(0);
}

/* Mobile Menu Header */
.mobile-menu-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    text-align: center;
}

body.dark-mode .mobile-menu-header {
    border-bottom-color: var(--dark-border);
}

.mobile-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 1rem;
}

.mobile-logo-img {
    height: 45px;
    width: 45px;
    object-fit: cover;
    border-radius: 50%;
}

.mobile-logo span {
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--primary-color);
}

.mobile-welcome {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--gray-600);
    background: var(--gray-100);
    padding: 0.5rem;
    border-radius: 20px;
}

body.dark-mode .mobile-welcome {
    background: #374151;
    color: #cbd5e1;
}

/* Mobile Navigation Links */
.mobile-nav-links {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
}

.mobile-nav-links a {
    padding: 0.9rem 1.5rem;
    text-decoration: none;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 500;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

body.dark-mode .mobile-nav-links a {
    color: #cbd5e1;
}

.mobile-nav-links a i {
    width: 24px;
    color: var(--primary-color);
}

.mobile-nav-links a:hover {
    background: var(--gray-100);
    color: var(--primary-color);
    border-left-color: var(--primary-color);
    padding-left: 1.8rem;
}

body.dark-mode .mobile-nav-links a:hover {
    background: #374151;
}

/* Mobile Divider */
.mobile-divider {
    height: 1px;
    background: var(--gray-200);
    margin: 0.5rem 1rem;
}

body.dark-mode .mobile-divider {
    background: var(--dark-border);
}

/* Mobile Language Section */
.mobile-lang-section,
.mobile-theme-section {
    padding: 0.8rem 1rem;
}

.mobile-lang-title,
.mobile-theme-title {
    font-size: 0.75rem;
    color: var(--gray-500);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-lang-buttons,
.mobile-theme-buttons {
    display: flex;
    gap: 0.8rem;
}

.mobile-lang-btn,
.mobile-theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 10px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    font-size: 0.8rem;
}

body.dark-mode .mobile-lang-btn,
body.dark-mode .mobile-theme-btn {
    background: #374151;
    border-color: #4b5563;
    color: #cbd5e1;
}

.mobile-lang-btn.active,
.mobile-theme-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.mobile-lang-btn:hover,
.mobile-theme-btn:hover {
    transform: translateY(-2px);
    background: var(--primary-color);
    color: white;
}

/* Mobile Auth Buttons */
.mobile-menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
    padding: 1rem;
    margin-top: auto;
}

.mobile-btn-login,
.mobile-btn-register,
.mobile-btn-dashboard,
.mobile-btn-logout {
    padding: 0.8rem;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: center;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.mobile-btn-login {
    background: transparent;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.mobile-btn-login:hover {
    background: var(--primary-color);
    color: white;
}

.mobile-btn-register,
.mobile-btn-dashboard {
    background: var(--primary-color);
    color: white;
    border: 2px solid var(--primary-color);
}

.mobile-btn-register:hover,
.mobile-btn-dashboard:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.mobile-btn-logout {
    background: transparent;
    border: 2px solid var(--error);
    color: var(--error);
}

.mobile-btn-logout:hover {
    background: var(--error);
    color: white;
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* ============================================
   MAIN CONTENT AREA - FIXED SPACING
   ============================================ */
/* Main content wrapper - proper spacing for fixed headers */
.main-content {
    position: relative;
    z-index: 1;
}

/* For pages that don't use .main-content wrapper */
.main-content .container,
.main-content > div,
body > .container,
body > main {
    margin-top: 0;
    padding-top: 0;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 992px) {
    .nav-container {
        padding: 0.8rem 1.5rem;
    }
    
    .nav-links {
        gap: 1.2rem;
    }
    
    .nav-links a {
        font-size: 0.85rem;
    }
    
    .logo span {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    /* Hide desktop navigation and buttons on mobile */
    .nav-links,
    .header-right {
        display: none;
    }
    
    /* Show mobile menu toggle */
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .nav-container {
        padding: 0.7rem 1rem;
    }
    
    .logo span {
        font-size: 0.85rem;
    }
    
    .logo-img {
        height: 35px;
        width: 35px;
    }
}

@media (max-width: 480px) {
    .nav-container {
        padding: 0.6rem 0.8rem;
    }
    
    .logo span {
        font-size: 0.75rem;
    }
    
    .logo-img {
        height: 30px;
        width: 30px;
    }
    
    .menu-toggle {
        font-size: 1.3rem;
        padding: 0.4rem;
    }
    
    .mobile-menu {
        width: 85%;
        max-width: 300px;
    }
}