/* =========================================================
   CODEWORD HEADER.CSS
   Original top bar and logo styling preserved.
   Responsive improvements apply mainly to navigation.
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: Segoe UI, sans-serif;
}

/* =========================
   TOP BAR - ORIGINAL STYLING
========================= */
.top-bar {
    background: #1e3a5f;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 10px 25px;
    flex-wrap: wrap;
}

.top-left {
    flex: 1;
    min-width: 250px;
}

.top-left span {
    font-size: 15px;
    font-weight: 600;
    line-height: 1.5;
}

.top-center {
    display: flex;
    align-items: center;
    gap: 16px;
}

.top-center a {
    color: #fff;
    font-size: 18px;
    transition: .3s;
}

.top-center a:hover {
    color: #ff9800;
}

.top-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

/* =========================
   USER BUTTONS - ORIGINAL
========================= */
#logged-user {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 0 18px;
    height: 42px;
    border-radius: 30px;
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    box-shadow: 0 5px 15px rgba(37, 99, 235, .35);
    transition: .3s;
}

#logged-user i {
    font-size: 18px;
    color: #ffd54f;
}

#logged-user:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(37, 99, 235, .45);
}

#teacher-dashboard-btn a,
#logout-btn a,
.hackathon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 18px;
    border-radius: 30px;
    font-weight: 600;
    transition: .3s;
    text-decoration: none;
    white-space: nowrap;
}

#teacher-dashboard-btn a {
    background: #22c55e;
    color: #fff;
}

#logout-btn a {
    background: #ef4444;
    color: #fff;
}

.hackathon-btn {
    background: linear-gradient(135deg, #ff5722, #ff9800);
    color: #fff !important;
}

#teacher-dashboard-btn a:hover,
#logout-btn a:hover,
.hackathon-btn:hover {
    transform: translateY(-2px);
}

/* Original top-bar responsive behavior retained */
@media (max-width: 768px) {
    .top-bar {
        padding: 18px 15px;
        flex-direction: column;
        gap: 18px;
        text-align: center;
    }

    .top-left {
        width: 100%;
    }

    .top-left span {
        display: block;
        font-size: 14px;
    }

    .top-center {
        width: 100%;
        justify-content: center;
    }

    .top-center a {
        font-size: 24px;
    }

    .top-right {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
        align-items: center;
    }

    #logged-user {
        grid-column: 1 / 3;
        justify-content: center;
        font-size: 18px;
    }

    #teacher-dashboard-btn,
    #logout-btn {
        width: 100%;
    }

    #teacher-dashboard-btn a,
    #logout-btn a {
        width: 100%;
        justify-content: center;
    }

    .hackathon-btn {
        grid-column: 1 / 3;
        width: 100%;
        justify-content: center;
        padding: 12px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    .top-bar {
        padding: 15px 12px;
    }

    .top-center {
        gap: 18px;
    }

    .top-center a {
        font-size: 22px;
    }

    #logged-user {
        font-size: 16px;
    }

    #teacher-dashboard-btn a,
    #logout-btn a {
        padding: 10px;
        font-size: 14px;
    }

    .hackathon-btn {
        padding: 12px;
        font-size: 15px;
    }
}

/* ================= HEADER ================= */
header {
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 999;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    width: 100%;
}

.navbar {
    width: 100%;
    max-width: 1250px;
    margin: auto;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.navbar > a:first-child {
    display: flex;
    flex: 0 0 auto;
    text-decoration: none;
    align-items: center;
}

/* ================= BRAND LOGO - ORIGINAL STYLING ================= */
.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.brand-icon {
    display: flex;
    align-items: center;
    font-size: 38px;
    font-weight: 900;
    letter-spacing: -2px;
}

.bracket.left {
    background: linear-gradient(135deg, #a855f7, #7c3aed, #4c1d95);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 6px rgba(124, 58, 237, 0.6));
}

.slash {
    color: #111827;
    margin: 0 1px;
    font-weight: 800;
}

.bracket.right {
    background: linear-gradient(135deg, #fb7185, #fb923c, #facc15);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 3px 6px rgba(251, 146, 60, 0.6));
}

.brand-text {
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 3px;
    margin-top: 2px;
    color: #111827;
    -webkit-font-smoothing: antialiased;
}

.brand-text span {
    color: #2563eb;
}

.bracket.left,
.bracket.right {
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
}

.brand:hover {
    transform: translateY(-1px) scale(1.03);
    transition: 0.25s ease;
}

.brand:hover .bracket.left {
    filter: drop-shadow(0 0 10px rgba(124, 58, 237, 0.9));
}

.brand:hover .bracket.right {
    filter: drop-shadow(0 0 10px rgba(251, 146, 60, 0.9));
}

@media (max-width: 600px) {
    .brand-icon {
        font-size: 26px;
    }

    .brand-text {
        font-size: 11px;
    }
}

/* ================= DESKTOP MENU ================= */
.menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(10px, 1.45vw, 22px);
    flex: 1 1 auto;
    min-width: 0;
}

.menu > a,
.menu > .dropdown > a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 10px 0;
    color: #222;
    font-size: clamp(12px, .95vw, 14px);
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    transition: color .25s ease;
}

.menu > a:hover,
.menu > .dropdown > a:hover,
.menu > .dropdown:focus-within > a {
    color: #ff9800;
}

.menu > .dropdown {
    position: relative;
    flex: 0 0 auto;
}

/* ================= DESKTOP DROPDOWN ================= */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    display: none;
    width: 220px;
    max-width: min(280px, 90vw);
    max-height: min(70vh, 450px);
    overflow-y: auto;
    padding: 10px;
    margin: 0;
    background: #fff;
    border: 1px solid #eee;
    border-radius: 8px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, .15);
    z-index: 1005;
    animation: fadeIn .2s ease;
}

.menu > .dropdown:hover > .dropdown-menu,
.menu > .dropdown:focus-within > .dropdown-menu {
    display: block;
}

.dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 5px;
    color: #222;
    font-size: 14px;
    line-height: 1.45;
    text-decoration: none;
    white-space: normal;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus-visible {
    color: #e87900;
    background: #f2f2f2;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================= HAMBURGER ================= */
.hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    color: #1e3a5f;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 25px;
    cursor: pointer;
}

.hamburger:hover {
    color: #ff9800;
    background: #fff8ef;
}

/* ================= MOBILE MENU PANEL ================= */
.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: min(340px, 90vw);
    height: 100vh;
    height: 100dvh;
    padding: 20px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #fff;
    box-shadow: -5px 0 15px rgba(0, 0, 0, .2);
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .35s ease, visibility .35s ease;
    z-index: 2000;
}

.mobile-menu.active {
    transform: translateX(0);
    visibility: visible;
    pointer-events: auto;
}

.mobile-header {
    position: sticky;
    top: -20px;
    z-index: 3;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin: -20px -20px 15px;
    padding: 12px 20px;
    background: #fff;
    border-bottom: 1px solid #eee;
}

.close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: #1e3a5f;
    border-radius: 7px;
    font-size: 26px;
    cursor: pointer;
}

.close-btn:hover {
    color: #ff9800;
    background: #fff4e8;
}

/* ================= MOBILE NAV LINKS ================= */
.mobile-links {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.mobile-links > a,
.mobile-links > .dropdown > a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 12px 10px;
    color: #222;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #eee;
    border-radius: 5px;
}

.mobile-links > a:hover,
.mobile-links > .dropdown > a:hover {
    color: #e87900;
    background: #fff7ed;
}

.mobile-links .dropdown {
    display: block;
    width: 100%;
    min-width: 0;
}

.mobile-links .dropdown > a {
    cursor: pointer;
}

/* Hide mobile dropdowns until JS adds mobile-open */
.mobile-links .dropdown-menu {
    position: static !important;
    display: none !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 7px !important;
    box-shadow: none !important;
    background: #f7f9fc !important;
    animation: none;
}

.mobile-links .dropdown-menu.mobile-open {
    display: block !important;
    padding: 6px !important;
    margin: 4px 0 8px !important;
}

.mobile-links .dropdown-menu a {
    display: flex;
    width: 100%;
    padding: 10px 12px;
    color: #39465a;
    font-size: 13px;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    border-bottom: 1px solid #e9edf3;
}

.mobile-links .dropdown-menu a:last-child {
    border-bottom: 0;
}

.mobile-links .dropdown-menu a:hover {
    color: #e87900;
    background: #fff0dc;
}

/* ================= RESPONSIVE NAVIGATION =================
   Keep desktop navigation at 1024px and other laptop widths.
   Switch to hamburger only at tablet/mobile widths (768px).
   Original top-bar and logo styling remain unchanged.
========================================================= */

/* Compact desktop menu for laptop/tablet-landscape widths */
@media (min-width: 769px) and (max-width: 1200px) {
    .navbar {
        gap: 10px;
    }

    .navbar .menu {
        display: flex !important;
        gap: clamp(6px, 0.75vw, 10px);
    }

    .navbar .menu > a,
    .navbar .menu > .dropdown > a {
        font-size: 12px;
    }

    .navbar .hamburger {
        display: none !important;
    }
}

/* Hamburger menu begins at tablet size */
@media (max-width: 768px) {
    .navbar .menu {
        display: none !important;
    }

    .navbar .hamburger {
        display: inline-flex !important;
    }
}

@media (max-width: 600px) {
    .navbar {
        padding: 12px 14px;
        gap: 10px;
    }

    .mobile-menu {
        width: min(360px, 92vw);
        padding: 16px;
        padding-bottom: 30px;
    }

    .mobile-header {
        top: -16px;
        margin: -16px -16px 12px;
        padding: 10px 16px;
    }

    .hamburger {
        width: 40px;
        height: 40px;
        font-size: 23px;
    }
}

@media (max-width: 360px) {
    .navbar {
        padding: 10px 11px;
        gap: 8px;
    }

    .mobile-menu {
        width: 94vw;
    }

    .hamburger {
        width: 38px;
        height: 38px;
        font-size: 22px;
    }
}

/* ================= ACCESSIBILITY ================= */
.menu a:focus-visible,
.mobile-links a:focus-visible,
.hamburger:focus-visible,
.close-btn:focus-visible {
    outline: 2px solid #ff9800;
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .mobile-menu,
    .brand,
    .menu a {
        transition: none;
    }
}
