/* Shared Navigation Styles */
:root {
    --nav-primary: #2563eb;
    --nav-primary-dark: #1e40af;
    --nav-text: #374151;
    --nav-text-light: #6b7280;
    --nav-background: #ffffff;
    --nav-border: #e5e7eb;
    --nav-hover: #f3f4f6;
}

/* Main Navigation */
.site-nav {
    background: var(--nav-background);
    border-bottom: 1px solid var(--nav-border);
    position: sticky;
    top: 0;
    z-index: 3000;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
}

/* Logo */
.nav-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--nav-primary);
}

.nav-logo img {
    height: 125px;
    max-width: 250px;
    object-fit: contain;
    margin-right: 0.75rem;
    transition: transform 0.3s ease, filter 0.2s ease;
    cursor: pointer;
}

.nav-logo:hover img {
    animation: logoPulse 0.4s ease-in-out;
    transform: scale(1.03);
    filter: brightness(1.05);
}

/* Reduced animation for accessibility */
@media (prefers-reduced-motion: reduce) {
    .nav-logo:hover img {
        animation: none;
        transform: scale(1.02);
        filter: brightness(1.03);
    }
}

/* Mobile optimization */
@media (max-width: 768px) {
    .nav-logo:hover img {
        transform: scale(1.02);
        filter: brightness(1.03);
    }
    
    @keyframes logoPulse {
        0% {
            transform: scale(1);
        }
        50% {
            transform: scale(1.04);
        }
        100% {
            transform: scale(1.02);
        }
    }
}

@keyframes logoPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.07);
    }
    100% {
        transform: scale(1.03);
    }
}

/* Navigation Links */
.nav-links {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav-links a {
    color: var(--nav-text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    letter-spacing: -0.025em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.nav-links a:hover {
    color: var(--nav-primary);
    background: var(--nav-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.1);
}

.nav-links a.active {
    color: var(--nav-primary);
    font-weight: 600;
    background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.1);
}

/* User Section */
.nav-user {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    margin-left: 2.5rem;
    padding-left: 2.5rem;
    border-left: 1px solid var(--nav-border);
    position: relative;
    overflow: visible;
}

/* Agent Portal Button */
.agent-portal-btn {
    background: linear-gradient(135deg, var(--nav-primary) 0%, var(--nav-primary-dark) 100%);
    color: white;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    letter-spacing: -0.025em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

.agent-portal-btn:hover {
    background: linear-gradient(135deg, var(--nav-primary-dark) 0%, #1e3a8a 100%);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.3);
}

/* Auth Links */
.auth-link {
    color: var(--nav-text-light);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.2s;
}

.auth-link:hover {
    color: var(--nav-primary);
}

/* User Info (when logged in) */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* User Profile Button */
.user-profile-btn {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.2s;
    overflow: visible !important;
}

.user-profile-btn:hover {
    background: var(--nav-hover);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--nav-border);
    display: none; /* Hidden by default, shown when user has profile picture */
}

.user-avatar.show {
    display: block; /* Show avatar when user has profile picture */
}

.user-name {
    font-weight: 600;
    background: var(--nav-primary);
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.user-name.hide {
    display: none !important; /* Hide initials when showing profile picture */
}

/* User Dropdown */
.user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--nav-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    padding: 0.5rem 0;
    min-width: 160px;
    z-index: 2000;
    display: none;
}

.user-profile-btn.open .user-dropdown {
    display: block;
}

.user-dropdown a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--nav-text);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.user-dropdown a:hover {
    background: var(--nav-hover);
    color: var(--nav-primary);
}

.logout-btn {
    color: var(--nav-text-light);
    text-decoration: none;
    font-size: 0.85rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    border: 1px solid var(--nav-border);
    transition: all 0.2s;
}

.logout-btn:hover {
    color: #dc2626;
    background: #fef2f2;
    border-color: #fecaca;
}

/* Mobile Navigation */
.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--nav-text);
    cursor: pointer;
    padding: 0.75rem;
    border-radius: 0.5rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-btn:hover {
    background: var(--nav-hover);
    color: var(--nav-primary);
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
}

/* Mobile Menu Overlay */
.mobile-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 10000;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu-overlay.active {
    display: block;
    opacity: 1;
}

/* Mobile Menu */
.mobile-menu {
    display: none;
    position: fixed;
    top: 0;
    right: -280px;
    width: 280px;
    height: auto;
    max-height: 100vh;
    background: linear-gradient(to bottom, #ffffff 0%, #f9fafb 100%);
    z-index: 10001;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    border-top-left-radius: 16px;
    border-bottom-left-radius: 16px;
}

.mobile-menu.active {
    display: block;
    right: 0;
}

.mobile-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
}

.mobile-menu-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    letter-spacing: -0.01em;
}

.mobile-menu-close {
    background: #f3f4f6;
    border: none;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.mobile-menu-close:hover {
    background: #2563eb;
    color: white;
}

.mobile-menu-content {
    padding: 12px 8px 20px 8px;
}

.mobile-menu-content a {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    color: #374151;
    text-decoration: none;
    font-weight: 500;
    font-size: 15px;
    border-radius: 8px;
    transition: all 0.2s;
    margin-bottom: 4px;
}

.mobile-menu-content a:hover {
    background: white;
    color: #2563eb;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.1);
    transform: translateX(-2px);
}

.mobile-menu-content a:last-child {
    margin-bottom: 0;
}

.mobile-menu-divider {
    height: 1px;
    background: linear-gradient(to right, transparent, #e5e7eb, transparent);
    margin: 12px 16px;
}

@media (max-width: 768px) {
    .nav-container {
        padding: 0 1rem;
        height: 70px;
    }

    .nav-links {
        display: none;
    }

    .nav-user {
        display: none; /* Hide on mobile, accessible via mobile menu */
    }

    .mobile-menu-btn {
        display: block;
    }

    .nav-logo {
        font-size: 1.1rem;
    }

    .nav-logo img {
        height: 125px;
        max-width: 200px;
    }

    /* Prevent body scroll when mobile menu is open */
    body.mobile-menu-open {
        overflow: hidden;
    }
}