/* === ROOT & BODY === */
:root {
    /* Colors from your new screenshot */
    --color-dark-green: #1a2b20;
    --color-bright-green: #8CFF82;  /* For 'Coding' */
    --color-yellow-green: #F0FF82;  /* For 'Rider' */
    --color-button-green: #B5FFB1;  /* For 'Sign Up' button */
    --color-active-link: #A3EA9F;   /* For 'Home' link */
    --color-accent-blue: #00AFFF;
    --color-white: #ffffff;
    --color-dark-text: #333333;
}

/* Global box-sizing – prevents ANY element from overflowing its container */
*, *::before, *::after {
    box-sizing: border-box;
}

html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background-color: #f4f4f4;
    overflow-x: hidden;
    width: 100%;
    min-width: 0;
}

/* Global image safety */
img, svg, video, canvas, iframe {
    max-width: 100%;
    height: auto;
}

/* === MAIN HEADER WRAPPER === */
.site-header {
    width: 100%;
    /* This shadow will appear under the entire header block */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.07);
}

.accent-bar {
    height: 4px;
    background-color: var(--color-accent-blue);
}

/* ============================================================
   TOPIC NAVIGATION SUB-HEADER (Quick Course Pills)
   ============================================================ */
.topic-nav-bar {
    background-color: #f1f5f9;
    border-bottom: 1px solid #e2e8f0;
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.topic-nav-bar::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.topic-nav-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 25px;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}

.topic-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 14px;
    background-color: #e0f2fe;
    color: #0284c7;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    border-radius: 7px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    user-select: none;
}

.topic-pill:hover {
    background-color: #0284c7;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(2, 132, 199, 0.25);
}

.topic-pill.active {
    background-color: #0284c7;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(2, 132, 199, 0.35);
}


/* === 1. TOP SLIM NAV === */
.top-nav {
    background-color: var(--color-white);
    height: 45px; /* Very slim */
    display: flex;
    justify-content: center;
    align-items: center;
    /* A subtle line to separate it from the main header */
    border-bottom: 1px solid #eee; 
}

.nav-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 45px; /* Space between each link */
}

.nav-links a {
    text-decoration: none;
    color: var(--color-dark-text);
    font-size: 1rem; /* 16px */
    font-weight: 500;
    padding: 11px 0; /* Vertical padding to help with alignment */
    
    /* This creates the highlight-line effect */
    border-bottom: 4px solid transparent; /* Placeholder for the line */
    transition: all 0.3s ease;
}

.nav-links a:hover {
    color: var(--color-active-link);
    border-bottom-color: var(--color-active-link);
}

/* Style for the "active" page */
.nav-links a.active {
    color: var(--color-active-link);
    font-weight: 600;
    border-bottom-color: var(--color-active-link);
}


/* === 2. MAIN HEADER === */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: var(--color-dark-green);
    
    /* ▼▼ THIS IS THE CHANGE ▼▼ */
    padding: 10px 30px; /* Was 15px 30px. Now slimmer. */
    /* ▲▲ THIS IS THE CHANGE ▲▲ */
}

/* Logo and Brand */
.brand-container {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.logo {
    width: 65px;
    height: 65px;
    margin-right: 12px;
    object-fit: contain;
}

.brand-name {
    font-size: 1.75rem;
    font-weight: 700;
}

.part1 {
    color: var(--color-bright-green);
}

.part2 {
    color: var(--color-yellow-green);
}

/* Search Bar */
.search-container {
    position: relative; /* Needed to position the icon */
    max-width: 400px;
    width: 100%;
}

.search-input {
    width: 100%;
    max-width: 400px;
    box-sizing: border-box;
    padding: 14px 20px 14px 45px; /* Make space for icon on the left */
    border: none;
    border-radius: 50px; /* Fully rounded */
    background-color: var(--color-white); /* White background */
    font-size: 0.9rem;
    font-family: 'Poppins', sans-serif;
    color: var(--color-dark-text);
}

.search-input:focus {
    outline: 2px solid var(--color-accent-blue);
}

.search-icon {
    position: absolute;
    left: 18px;
    top: 50%;
    transform: translateY(-50%); /* Perfect vertical centering */
    color: #555;
}

/* Buttons */
.button-container {
    display: flex;
    gap: 15px;
}

.btn {
    padding: 12px 28px;
    border: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-signup {
    background-color: var(--color-button-green); /* New light green */
    color: var(--color-dark-green); /* Dark text */
}

.btn-signup:hover {
    background-color: #a0e89c; /* Slightly darker on hover */
}

.btn-login {
    background-color: var(--color-white);
    color: var(--color-dark-green);
}

.btn-login:hover {
    background-color: #f0f2f5;
}

/* === MOBILE RESPONSIVE NAVIGATION === */

/* Toggle menu button styles */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px; /* Space between lines */
    border-radius: 4px;
    transition: background-color 0.2s ease;
    padding: 0;
}

.mobile-menu-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

/* Custom Hamburger Icon Lines */
.hamburger-line {
    display: block;
    width: 22px;
    height: 2px;
    background-color: var(--color-white);
    border-radius: 2px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Morph to 'X' (Close Icon) when Active */
.mobile-menu-toggle.active .hamburger-line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

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

.mobile-menu-toggle.active .hamburger-line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* === BREAKPOINT FOR TABLETS & MOBILE === */
@media (max-width: 992px) {
    /* Site Header wrapper setup to reorder elements on mobile */
    .site-header {
        display: flex;
        flex-direction: column;
    }

    .main-header {
        order: 1; /* Main header on top */
        padding: 8px 12px;
        gap: 8px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap; /* Keep single row */
    }

    .accent-bar {
        order: 3;
    }

    .topic-nav-bar {
        order: 4;
        background-color: #f8fafc;
    }

    /* Logo size for tablet and mobile */
    .brand-container {
        display: flex;
        align-items: center;
        flex-shrink: 0;
    }

    .logo {
        width: 48px;
        height: 48px;
        margin-right: 8px;
        object-fit: contain;
    }

    .brand-name {
        font-size: 0.95rem;
    }

    /* Small/responsive search bar in main header */
    .search-container {
        flex: 1;
        max-width: 160px;
        min-width: 80px;
        margin: 0;
    }

    .search-input {
        width: 100%;
        box-sizing: border-box;
        padding: 8px 10px 8px 30px;
        font-size: 0.75rem;
        height: 34px;
    }

    .search-icon {
        left: 10px;
        font-size: 0.75rem;
    }

    /* Small auth buttons in main header */
    .button-container {
        display: flex;
        gap: 6px;
        flex-shrink: 0;
    }

    .btn {
        padding: 6px 12px;
        font-size: 0.75rem;
        border-radius: 30px;
    }

    /* Hamburger Button toggler */
    .mobile-menu-toggle {
        display: flex;
        flex-shrink: 0;
    }

    /* Top-Nav Dropdown styled under main header */
    .top-nav {
        order: 2; /* Dropped down below main header */
        display: none; /* Toggle hidden state */
        width: 100%;
        height: auto;
        background-color: var(--color-white);
        border-bottom: 1px solid #eee;
        padding: 10px 0;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
        transition: all 0.3s ease-in-out;
    }

    .top-nav.open {
        display: flex;
        justify-content: flex-start;
        align-items: stretch;
    }

    .nav-links {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .nav-links li {
        width: 100%;
    }

    .nav-links a {
        display: block;
        width: 100%;
        box-sizing: border-box;
        padding: 12px 24px;
        font-size: 0.95rem;
        border-bottom: none;
        border-left: 4px solid transparent;
        transition: all 0.2s ease;
    }

    .nav-links a:hover,
    .nav-links a.active {
        background-color: #f9fbf9;
        border-left-color: var(--color-active-link);
        border-bottom-color: transparent;
        color: var(--color-active-link);
    }
}

/* Tablet and Mobile profile button & topic pills */
@media (max-width: 768px) {
    .header-user-name {
        display: none !important;
    }
    .btn-user-profile {
        padding: 6px 10px;
        font-size: 1rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border-radius: 50px;
    }
    .btn-user-profile i {
        font-size: 1.15rem;
        margin: 0;
    }

    .topic-nav-inner {
        padding: 6px 12px;
        gap: 6px;
    }

    .topic-pill {
        padding: 5px 11px;
        font-size: 0.8rem;
        border-radius: 6px;
    }
}

/* Extra small devices styling */
@media (max-width: 480px) {
    /* Hide the brand name text to fit Logo, Search, Buttons, Hamburger on 320px-375px screens */
    .brand-name {
        display: none;
    }
    
    .logo {
        width: 46px;
        height: 46px;
        margin-right: 6px;
        object-fit: contain;
    }

    .search-container {
        max-width: 95px; /* narrow on extra small devices */
    }

    .button-container {
        gap: 4px;
    }

    .btn {
        padding: 6px 8px;
        font-size: 0.72rem;
    }

    .btn-logout span {
        display: none;
    }

    .btn-logout {
        padding: 6px 8px;
    }
}


/* Auth & Logout Enhancements */
/*
 * mobile-nav-auth items (Dashboard + Logout links in the hamburger dropdown)
 * are permanently hidden because the .button-container in .main-header
 * already shows those buttons on ALL screen sizes. Showing them in BOTH
 * places caused the duplicate "Account / Logout" issue.
 */
.mobile-nav-auth {
    display: none !important;
}

.btn-logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #ffffff;
    color: #334155;
    border: 1px solid #e2e8f0;
}

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