/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600;700;800&family=Poppins:wght@400;500;600&display=swap');

/* CSS Variables */
:root {
    --yellow-primary: #FFD700;
    --yellow-glow: rgba(255, 215, 0, 0.3);
    --dark-bg: #0A0A0A;
    --dark-secondary: #1a1a1a;
    --text-primary: #DDDDDD;
    --text-hover: #FFD700;
    --text-dark: #000000;
}

/* Body adjustment for fixed header */
body {
    padding-top: 80px; /* Match header height exactly */
}

/* Header Styles */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--dark-bg);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    min-width: 320px; /* Ensure minimum width to prevent layout breaking */
}

.header-container {
    width: 100%;
    padding: 0 2rem 0 1rem;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    height: 80px;
    min-width: 320px; /* Ensure minimum width */
    overflow: hidden; /* Prevent horizontal overflow */
}

/* Logo Styles */
.header-logo {
    z-index: 1001;
}

.logo-link {
    font-family: 'Sora', sans-serif;
    font-weight: 800;
    font-size: 1.75rem;
    color: var(--yellow-primary);
    text-decoration: none;
    transition: all 0.3s ease;
    text-shadow: 0 0 10px var(--yellow-glow);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-link:hover {
    transform: scale(1.05);
    text-shadow: 0 0 20px var(--yellow-glow);
}

.logo-image {
    height: 2.5rem;
    width: auto;
    max-width: 2.5rem;
    object-fit: contain;
    filter: drop-shadow(0 0 10px var(--yellow-glow));
    transition: all 0.3s ease;
}

.logo-text {
    display: inline-block;
}

/* Responsive logo sizing */
@media (max-width: 768px) {
    .logo-image {
        height: 2rem;
        max-width: 2rem;
    }
    
    .logo-text {
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .logo-image {
        height: 1.75rem;
        max-width: 1.75rem;
    }
    
    .logo-text {
        font-size: 1.25rem;
    }
    
    .logo-link {
        gap: 0.25rem;
    }
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 1001;
}

.hamburger-line {
    width: 100%;
    height: 3px;
    background: var(--yellow-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
}

.mobile-menu-toggle:hover .hamburger-line {
    background: var(--text-hover);
    box-shadow: 0 0 10px var(--yellow-glow);
}

/* Desktop Navigation */
.header-nav {
    display: flex;
    margin-left: auto;
}

.nav-list {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-item {
    position: relative;
}

.nav-link {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 1rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    white-space: nowrap;
}

.nav-link:hover {
    color: var(--text-hover);
    text-shadow: 0 0 10px var(--yellow-glow);
}

/* Log In Button */
.btn-login {
    border: 2px solid var(--yellow-primary) !important;
    background: transparent !important;
    color: var(--yellow-primary) !important;
    padding: 0.6rem 1.5rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
}

.btn-login:hover {
    background: rgba(255, 215, 0, 0.1) !important;
    color: var(--yellow-primary) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--yellow-glow);
}

/* Sign Up Button */
.btn-signup {
    background: var(--yellow-primary) !important;
    color: var(--text-dark) !important;
    padding: 0.6rem 1.5rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    border: 2px solid var(--yellow-primary) !important;
}

.btn-signup:hover {
    background: #ffed4e !important;
    color: var(--text-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--yellow-glow);
}

/* Generate CTA Button */
.btn-generate {
    background: var(--yellow-primary) !important;
    color: var(--text-dark) !important;
    padding: 0.6rem 1.5rem !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    box-shadow: 0 4px 15px var(--yellow-glow);
}

.btn-generate:hover {
    background: #ffed4e !important;
    color: var(--text-dark) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px var(--yellow-glow);
}

/* Header spacer for mobile layout */
.header-spacer {
    width: 30px; /* Same width as mobile menu toggle */
    display: none;
}

/* Mobile Navigation Styles */
.mobile-nav {
    position: fixed;
    top: 0px; /* Position directly under the header */
    left: 0;
    right: 0;
    background: var(--dark-bg);
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 999;
    display: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
}

.mobile-nav.mobile-nav-open {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.mobile-nav-list {
    list-style: none;
    margin: 0;
    padding: 0.5rem 0.5rem; /* Reduced top/bottom padding */
    display: flex;
    flex-direction: column;
    gap: 0.5rem; /* Reduced gap between items */
}

.mobile-nav-item {
    width: 100%;
}

.mobile-nav-link {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    font-size: 1.1rem;
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.5rem 0.5rem; /* Reduced vertical padding */
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    text-align: left;
    border: 1px solid transparent;
    white-space: nowrap;
}

.mobile-nav-link:hover {
    color: var(--text-hover);
    background: rgba(255, 215, 0, 0.05);
    border-color: rgba(255, 215, 0, 0.2);
    text-shadow: 0 0 10px var(--yellow-glow);
}

/* Mobile Log In Button */
.mobile-btn-login {
    border: 2px solid var(--yellow-primary) !important;
    background: transparent !important;
    color: var(--yellow-primary) !important;
    font-weight: 600 !important;
    text-align: center !important;
}

.mobile-btn-login:hover {
    background: rgba(255, 215, 0, 0.1) !important;
    color: var(--yellow-primary) !important;
    box-shadow: 0 4px 15px var(--yellow-glow);
}

/* Mobile Sign Up Button */
.mobile-btn-signup {
    background: var(--yellow-primary) !important;
    color: var(--text-dark) !important;
    font-weight: 600 !important;
    border: 2px solid var(--yellow-primary) !important;
    text-align: center !important;
}

.mobile-btn-signup:hover {
    background: #ffed4e !important;
    color: var(--text-dark) !important;
    box-shadow: 0 4px 15px var(--yellow-glow);
}

/* Hamburger animation when menu is open */
.mobile-menu-toggle.menu-open .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.mobile-menu-toggle.menu-open .hamburger-line:nth-child(2) {
    opacity: 0;
}

.mobile-menu-toggle.menu-open .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Account Dropdown Styles */
.account-dropdown-container {
    position: relative;
}

#account-dropdown {
    display: none;
    position: absolute; /* will be overridden to fixed via JS when opened */
    top: 100%;
    right: 0;
    background: #1a1a1a;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    min-width: 200px;
    z-index: 1002; /* above fixed header */
    padding: 1rem;
}

.dropdown-user-section {
    margin-bottom: 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
    padding-bottom: 1rem;
}

.dropdown-username {
    color: #DDDDDD;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.dropdown-role-badge {
    background: rgba(255, 215, 0, 0.2);
    color: #FFD700;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    display: inline-block;
}

.dropdown-link {
    display: block;
    color: #DDDDDD;
    text-decoration: none;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

.dropdown-link:last-child {
    margin-bottom: 0;
}

.dropdown-link:hover {
    color: #FFD700;
}

.language-dropdown-container {
    position: relative;
}

.language-dropdown {
    display: none;
    position: fixed; /* positioned via JS just below header */
    background: #1a1a1a;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    min-width: 220px;
    z-index: 1002; /* above header (which is 1000) */
    padding: 0.5rem 0.75rem;
    max-height: 320px;
    overflow-y: auto;
}

.language-dropdown .dropdown-link {
    display: block;
    color: #DDDDDD;
    text-decoration: none;
    padding: 0.5rem 0;
    margin-bottom: 0.25rem;
}

.language-dropdown .dropdown-link:last-child {
    margin-bottom: 0;
}

.language-dropdown .dropdown-link:hover {
    color: #FFD700;
}

/* Mobile Account Expandable Section */
.mobile-account-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(255, 215, 0, 0.05);
    border-radius: 8px;
    margin-top: 0.5rem;
}

.mobile-account-submenu.mobile-submenu-open {
    max-height: 300px; /* Adjust as needed */
}

.mobile-user-info {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.mobile-username {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
    margin-bottom: 0.5rem;
}

.mobile-role-badge {
    background: rgba(255, 215, 0, 0.2);
    color: var(--yellow-primary);
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-block;
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.mobile-submenu-link {
    display: block;
    padding: 0.75rem 1rem;
    color: var(--text-primary);
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    font-size: 1rem;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.mobile-submenu-link:hover {
    background: rgba(255, 215, 0, 0.1);
    color: var(--text-hover);
}

.mobile-submenu-link:last-child {
    border-bottom: none;
    border-radius: 0 0 8px 8px;
}

/* Mobile language submenu mirrors account submenu */
.mobile-language-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
    background: rgba(255, 215, 0, 0.05);
    border-radius: 8px;
}

.mobile-language-submenu.mobile-submenu-open {
    max-height: 300px;
}

/* Make mobile nav scrollable */
.mobile-nav {
    max-height: calc(100vh - 70px); /* Account for header height */
    overflow-y: auto;
}

/* Ensure proper stacking context */
.main-header * {
    position: relative;
    z-index: inherit;
}

/* Smooth scrolling for anchor links */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px; /* Account for fixed header height */
}

/* ==== RESPONSIVE DESIGN ==== */

/* Small Desktop and Tablet Landscape */
@media (max-width: 1024px) {
    .header-container {
        padding: 0 1.5rem;
    }
    
    .nav-list {
        gap: 0.4rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
    }
    
    .btn-login,
    .btn-signup {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.8rem !important;
    }
    
    .logo-link {
        font-size: 1.4rem;
    }
}

/* Smaller Desktop - More aggressive spacing */
@media (max-width: 900px) {
    .header-container {
        padding: 0 1rem 0 1rem;
    }
    
    .nav-list {
        gap: 0.3rem;
    }
    
    .nav-link {
        padding: 0.4rem 0.5rem;
        font-size: 0.85rem;
    }
    
    .btn-login,
    .btn-signup {
        padding: 0.4rem 0.6rem !important;
        font-size: 0.75rem !important;
    }
    
    .logo-link {
        font-size: 1.2rem;
    }
    
    .logo-image {
        height: 2rem;
        max-width: 2rem;
    }
}

/* Very Small Desktop - Most aggressive spacing */
@media (max-width: 800px) {
    .header-container {
        padding: 0 0.75rem 0 1rem;
    }
    
    .nav-list {
        gap: 0.15rem;
    }
    
    .nav-link {
        padding: 0.3rem 0.4rem;
        font-size: 0.8rem;
    }
    
    .btn-login,
    .btn-signup {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.7rem !important;
    }
    
    .logo-link {
        font-size: 1.1rem;
    }
    
    .logo-image {
        height: 1.8rem;
        max-width: 1.8rem;
    }
}

/* Medium Desktop */
@media (max-width: 1200px) {
    .header-container {
        padding: 0 1.5rem;
    }
    
    .nav-list {
        gap: 0.6rem;
    }
    
    .nav-link {
        padding: 0.5rem 0.85rem;
    }
}

/* Mobile and Tablet Portrait */
@media (max-width: 768px) {
    body {
        padding-top: 70px; /* Match mobile header height exactly */
    }
    
    .header-container {
        height: 70px;
        padding: 0 1rem;
        justify-content: space-between;
    }
    
    .header-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1001;
    }
    
    .logo-link {
        font-size: 1.5rem;
    }
    
    .mobile-menu-toggle {
        display: flex;
        order: -1;
    }
    
    .header-spacer {
        display: block;
    }
    
    .header-nav {
        display: none;
    }
    
    html {
        scroll-padding-top: 70px; /* Account for mobile header height */
    }
}

@media (max-width: 480px) {
    .header-container {
        padding: 0 1rem;
    }
    
    .logo-link {
        font-size: 1.3rem;
    }
    
    .mobile-nav-list {
        padding: 1rem;
        gap: 0.75rem;
    }
    
    .mobile-nav-link {
        padding: 0.75rem;
        font-size: 1rem;
    }
}