/* ============================================
   HEADER STYLES - Fixed positioning & containment
   ============================================ */

@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap");

@font-face {
    font-family: 'OSauce';
    src: url('OSauce.ttf');
}

@font-face {
    font-family: 'techno';
    src: url('ethnocentric rg it.otf');
}

/* Variables */
:root {
    --primary-dark: #001f3f;
    --primary-accent: #ffd43b;
    --secondary-accent: #ff4500;
    --bg-light: #fff;
    --text-dark: #001f3f;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --transition: 0.3s ease;
    --header-height: 70px;
    --color-primary: #6366f1;
    --color-primary-dark: #4f46e5;
}

/* Reset */
header {
    margin: 0;
    font-family: "Poppins", sans-serif;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    border: none;
    background: none;
    cursor: pointer;
}

/* User Messages */
.user-message {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 400px;
    text-align: center;
    z-index: 1000;
    padding: 15px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    animation: slideInOut 4s forwards;
    font-weight: 600;
    font-size: 1rem;
}

.login-message {
    background: #4CAF50;
    color: #fff;
}

.registration-message {
    background: var(--primary-dark);
    color: var(--primary-accent);
}

.logout-message {
    background: var(--primary-accent);
    color: var(--primary-dark);
}

@keyframes slideInOut {
    0% { top: -100%; opacity: 0; }
    20% { top: 20px; opacity: 1; }
    80% { top: 20px; opacity: 1; }
    100% { top: -100%; opacity: 0; }
}

/* ============================================
   HEADER CONTAINER - Fixed & Contained
   ============================================ */
.header-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    height: var(--header-height);
    background: var(--bg-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 clamp(16px, 4vw, 40px);
    transition: var(--transition);
    z-index: 100;
    box-shadow: var(--shadow);
    box-sizing: border-box;
    /* Removed overflow: hidden to allow dropdown to show */
}

/* ============================================
   LOGO - Stays Left
   ============================================ */
.logo-container {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    z-index: 101;
}

.style-logo {
    font-family: 'techno', sans-serif;
    font-size: clamp(1.2rem, 2.5vw, 1.6rem);
    display: flex;
    align-items: center;
    white-space: nowrap;
}

.parlay-text {
    background: linear-gradient(to right, #034747, var(--primary-dark));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.buddy-text {
    background: linear-gradient(to right, #ffbf00, var(--primary-accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.style-logo:hover .parlay-text {
    background: linear-gradient(to right, #046666, #003f5f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.style-logo:hover .buddy-text {
    background: linear-gradient(to right, #ffcf33, #ffde66);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ============================================
   NAVIGATION - Centered
   ============================================ */
.nav-menu {
    display: flex;
    gap: clamp(12px, 2vw, 20px);
    align-items: center;
}

.nav-menu a {
    font-weight: 500;
    font-size: clamp(0.75rem, 1.4vw, 1rem);
    color: var(--text-dark);
    position: relative;
    transition: var(--transition);
    white-space: nowrap;
}

.nav-menu a:hover{
  color: var(--color-primary);
}

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--color-primary-dark);
    transform: scaleX(0);
    transition: var(--transition);
}

.nav-menu a:hover::after,
.nav-menu a.active::after {
    transform: scaleX(1);
}

.nav-menu a.active {
    color: var(--secondary-accent);
}

.nav-menu a.active::after {
    background: var(--secondary-accent);
}

/* Desktop Nav - Absolutely centered */
.desktop-nav {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* ============================================
   USER SECTION - Stays Right
   ============================================ */
.user-section {
    flex-shrink: 0;
    margin-left: auto;
}

/* Dropdown */
.header-dropdown {
    position: relative;
}

.dropdown-toggle {
    font-size: clamp(0.8rem, 1.4vw, 1rem);
    color: var(--text-dark);
    padding: 8px 15px;
    transition: var(--transition);
    white-space: nowrap;
}

.dropdown-toggle:hover {
    background: #f0f0f0;
    border-radius: 5px;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--bg-light);
    list-style: none;
    padding: 10px 0;
    margin: 0;
    min-width: 180px;
    box-shadow: var(--shadow);
    opacity: 0;
    transform: translateY(-10px);
    transition: var(--transition);
    pointer-events: none;
    font-size: 0.9rem;
    border-radius: 8px;
}

.dropdown-menu.open {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.dropdown-menu li a,
.dropdown-menu li button {
    display: block;
    padding: 10px 20px;
    color: var(--text-dark);
    transition: var(--transition);
    width: 100%;
    text-align: left;
}

.dropdown-menu li a:hover,
.dropdown-menu li button:hover {
    background: #f0f0f0;
}

/* ============================================
   MOBILE TOGGLE
   ============================================ */
.mobile-toggle {
    display: none;
    font-size: 28px;
    color: var(--text-dark);
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    position: relative;
    padding: 0;
    margin-left: auto;
    flex-shrink: 0;
    z-index: 102;
}

.mobile-toggle::before,
.mobile-toggle::after,
.mobile-toggle span {
    content: '';
    position: absolute;
    left: 5px;
    width: 30px;
    height: 3px;
    background-color: var(--text-dark);
    transition: transform 0.3s ease, opacity 0.3s ease, top 0.3s ease;
    border-radius: 2px;
}

.mobile-toggle::before { top: 10px; }
.mobile-toggle span { top: 19px; }
.mobile-toggle::after { top: 28px; }

/* X animation when open */
.mobile-toggle.open::before {
    transform: rotate(45deg);
    top: 19px;
}

.mobile-toggle.open span { 
    opacity: 0; 
}

.mobile-toggle.open::after {
    transform: rotate(-45deg);
    top: 19px;
}

/* ============================================
   MOBILE NAVIGATION
   ============================================ */
.mobile-nav {
    display: none;
}

.mobile-header {
    display: none;
}

.mobile-username {
    font-size: 1.4rem;
    font-weight: 600;
    color: #27ae60;
}

/* Open state for header when menu is active */
.header-container.header-menu-open {
    background: var(--bg-light);
}

.header-container.header-menu-open .parlay-text,
.header-container.header-menu-open .buddy-text {
    background: linear-gradient(to right, #001f3f, #001f3f);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ============================================
   RESPONSIVE - Tablet & Mobile
   ============================================ */
@media (max-width: 1200px) {
    .desktop-nav,
    .user-section {
        display: none;
    }
    
    .mobile-toggle {
        display: block;
    }

    .nav-menu.mobile-nav {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 0;
        opacity: 0;
        transform: translateY(-10px);
        pointer-events: none;
        transition: opacity 0.25s ease, transform 0.25s ease;
        z-index: 90;
        padding: 90px 20px 40px;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        max-height: 100vh;
        box-sizing: border-box;
    }

    .mobile-nav.open {
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }

    /* Mobile Header - User greeting */
    .mobile-nav.open .mobile-header {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        width: 100%;
        padding: 0 4px 20px;
        box-sizing: border-box;
        border-bottom: 1px solid #e2e8f0;
        margin-bottom: 20px;
    }

    .mobile-username {
        font-size: 1.25rem;
        font-weight: 700;
        color: #1e293b;
        display: flex;
        align-items: center;
        gap: 10px;
    }
    
    .mobile-username::before {
        content: '👋';
        font-size: 1.25rem;
    }

    /* Mobile Grid - Main Navigation */
    .mobile-grid {
        width: 100%;
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
        padding: 0;
        box-sizing: border-box;
    }

    .nav-tile {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 10px;
        padding: 20px 12px;
        text-align: center;
        background: #ffffff;
        width: 100%;
        transition: all 0.2s ease;
        border-radius: 16px;
        border: 1px solid #e2e8f0;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .nav-tile:hover {
        border-color: #6366f1;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
        transform: translateY(-2px);
    }

    .nav-tile:active { 
        transform: scale(0.98); 
    }

    .nav-tile.active {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
        border-color: #6366f1;
    }

    .mobile-nav .nav-icon {
        width: 32px;
        height: 32px;
        display: block;
        margin: 0 auto;
        object-fit: contain;
        opacity: 0.85;
    }

    .nav-tile span {
        font-size: 0.8rem;
        font-weight: 600;
        color: #1e293b;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    /* Divider between sections */
    .mobile-divider {
        width: 100%;
        margin: 24px 0;
        border: 0;
        border-top: 1px solid #e2e8f0;
        position: relative;
    }
    
    .mobile-divider::after {
        content: 'ACCOUNT';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: #f8fafc;
        padding: 0 12px;
        font-size: 0.65rem;
        font-weight: 600;
        color: #94a3b8;
        letter-spacing: 1px;
    }

    /* Account Section */
    .account-section {
        display: flex;
        flex-direction: column;
        gap: 12px;
        padding: 0;
    }

    .account-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .account-grid .nav-tile {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 8px;
        padding: 16px 12px;
        width: 100%;
        border-radius: 16px;
        text-align: center;
        background: #ffffff;
        border: 1px solid #e2e8f0;
        transition: all 0.2s ease;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .account-grid .nav-tile:hover {
        border-color: #6366f1;
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.15);
        transform: translateY(-2px);
    }

    .account-grid .nav-tile:active { 
        transform: scale(0.98); 
    }

    .account-grid .nav-icon {
        width: 26px;
        height: 26px;
        object-fit: contain;
        display: block;
        opacity: 0.8;
    }

    .account-grid .nav-tile span {
        font-size: 0.75rem;
        font-weight: 600;
        color: #1e293b;
    }

    .account-grid .grid-span-2 {
        grid-column: 1 / -1;
        width: 100%;
    }

    /* Logout button - subtle danger styling */
    .account-grid .nav-tile-cta {
        max-width: 100%;
        background: #fef2f2;
        border-color: #fecaca;
    }
    
    .account-grid .nav-tile-cta:hover {
        background: #fee2e2;
        border-color: #f87171;
        box-shadow: 0 4px 12px rgba(239, 68, 68, 0.15);
    }
    
    .account-grid .nav-tile-cta span {
        color: #dc2626;
    }

    /* Remove underline from mobile tiles */
    .mobile-grid .nav-tile::after,
    .account-grid .nav-tile::after {
        display: none !important;
        content: none !important;
    }

    .mobile-grid .nav-tile:focus,
    .account-grid .nav-tile:focus {
        outline: 2px solid #6366f1;
        outline-offset: 2px;
    }

    .mobile-grid .nav-tile {
        -webkit-tap-highlight-color: transparent;
    }
}

/* Small screens - tighter spacing */
@media (max-width: 1200px) and (max-height: 700px) {
    .nav-menu.mobile-nav {
        padding: 70px 0 24px;
        gap: 12px;
    }

    .mobile-grid,
    .account-grid {
        gap: 10px;
    }

    .nav-tile {
        padding: 10px 6px;
    }
}

/* Body scroll lock when menu open */
body.menu-open {
    overflow: hidden;
}

/* ============================================
   LARGE SCREENS - Ensure header stays contained
   ============================================ */
@media (min-width: 1600px) {
    .header-container {
        padding: 0 60px;
    }
    
    .nav-menu a {
        font-size: 1rem;
    }
    
    .style-logo {
        font-size: 1.6rem;
    }
    
    .dropdown-toggle {
        font-size: 1rem;
    }
}