/* =========================================================
   CODEWORD HEADER CSS
   Matches the supplied homepage HTML exactly.
   Theme: Navy + White + Electric Blue
   Includes top bar, desktop navbar, dropdowns and mobile drawer.
========================================================= */

/* Scope box sizing to header elements to avoid affecting page sections */
.top-bar,
.top-bar *,
header,
header *,
.mobile-menu,
.mobile-menu *,
.cw-topbar,
.cw-topbar * {
    box-sizing: border-box;
}

.top-bar,
.cw-topbar {
    --cw-navy: #111827;
    --cw-navy-light: #172a48;
    --cw-blue: #2563eb;
    --cw-blue-dark: #1d4ed8;
    --cw-blue-light: #60a5fa;
    --cw-text: #172033;
    --cw-border: #dbe3ed;
    font-family: "Poppins", "Segoe UI", sans-serif;
}

/* =========================================================
   TOP UTILITY BAR
   Supports the supplied .cw-topbar HTML.
========================================================= */

.cw-topbar {
    position: relative;
    z-index: 1001;
    width: 100%;
    margin: 0;
    padding: 0;
    color: #f8fafc;
    background:
        radial-gradient(circle at 78% -45%, rgba(59, 130, 246, .2), transparent 40%),
        linear-gradient(110deg, #101827 0%, #131f34 58%, #172a48 100%);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 4px 15px rgba(15, 23, 42, .13);
}

.cw-topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    width: 100%;
    max-width: 1500px;
    min-height: 66px;
    margin: 0 auto;
    padding: 10px clamp(16px, 2.5vw, 36px);
}

.cw-topbar-identity {
    display: flex;
    align-items: center;
    gap: 11px;
    flex: 1 1 auto;
    min-width: 0;
}

.cw-topbar-indicator {
    position: relative;
    display: inline-block;
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cw-blue-light);
    box-shadow: 0 0 12px rgba(59, 130, 246, .65);
}

.cw-topbar-indicator::after {
    content: "";
    position: absolute;
    inset: -4px;
    border: 1px solid rgba(96, 165, 250, .45);
    border-radius: 50%;
    animation: cw-topbar-pulse 2.4s ease-out infinite;
}

.cw-topbar-title {
    display: block;
    color: #f8fafc;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.6;
    letter-spacing: .05px;
    overflow-wrap: anywhere;
}

.cw-topbar-social {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 5px;
}

.cw-topbar-social a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 35px;
    height: 35px;
    color: #e2e8f0;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 16px;
    text-decoration: none;
    transition: color .25s ease, background .25s ease,
        border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.cw-topbar-social a:hover {
    color: #fff;
    background: rgba(59, 130, 246, .17);
    border-color: rgba(96, 165, 250, .3);
    box-shadow: 0 5px 14px rgba(0, 0, 0, .13);
    transform: translateY(-2px);
}

.cw-topbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 0 0 auto;
    gap: 9px;
}

.cw-topbar-actions #user-info,
.cw-topbar-actions #logout-btn {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.cw-topbar-login,
.cw-topbar-logout,
.cw-topbar-hackathon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 39px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-family: inherit;
    font-size: 11.5px;
    font-weight: 700;
    line-height: 1.4;
    text-decoration: none;
    white-space: nowrap;
    transition: color .25s ease, background .25s ease,
        border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}

.cw-topbar-login {
    color: #172033;
    background: #fff;
    border-color: #e2e8f0;
    box-shadow: 0 3px 9px rgba(0, 0, 0, .09);
}

.cw-topbar-login i {
    color: var(--cw-blue);
    font-size: 12px;
}

.cw-topbar-login:hover {
    color: var(--cw-blue);
    background: #eff6ff;
    border-color: #bfdbfe;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(37, 99, 235, .13);
}

.cw-topbar-logout {
    color: #fecaca;
    background: rgba(220, 38, 38, .1);
    border-color: rgba(248, 113, 113, .3);
}

.cw-topbar-logout:hover {
    color: #fff;
    background: #b91c1c;
    border-color: #ef4444;
    transform: translateY(-2px);
}

.cw-topbar-hackathon {
    color: #fff;
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    border-color: rgba(147, 197, 253, .22);
    box-shadow: 0 4px 12px rgba(37, 99, 235, .22),
        inset 0 1px 0 rgba(255, 255, 255, .13);
}

.cw-topbar-hackathon i {
    font-size: 11px;
    transition: transform .25s ease;
}

.cw-topbar-hackathon:hover {
    color: #fff;
    background: linear-gradient(135deg, #3b82f6, #1d4ed8);
    transform: translateY(-2px);
    box-shadow: 0 7px 18px rgba(37, 99, 235, .32);
}

.cw-topbar-hackathon:hover i {
    transform: translateX(3px);
}

/* =========================================================
   MAIN HEADER / NAVBAR
   Supplied HTML uses a plain <header> and .navbar.
   Sticky positioning is deliberately disabled so this header
   does not unexpectedly become fixed/sticky on scroll.
========================================================= */

header {
    position: relative;
    top: auto;
    z-index: 999;
    width: 100%;
    margin: 0;
    background: #fff;
    border-bottom: 1px solid #d7dee8;
    box-shadow: 0 6px 20px rgba(17, 24, 39, .09);
    font-family: "Poppins", "Segoe UI", sans-serif;
}

.navbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    width: 100%;
    max-width: 1500px;
    min-height: 76px;
    margin: 0 auto;
    padding: 11px clamp(16px, 2.2vw, 32px);
    background: #fff;
}


/* =========================================
   CODEWORD IMAGE LOGO
========================================= */

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

.brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.25s ease;
}

.brand-logo {
    display: block;
    width: 175px;
    height: 60px;
    max-width: 100%;
    object-fit: contain;
    object-position: left center;
    border: none;
    outline: none;
    box-shadow: none;
    transition: filter 0.25s ease;
}

.brand:hover {
    transform: translateY(-1px);
}

.brand:hover .brand-logo {
    filter: brightness(1.04);
}

/* Tablet and smaller laptops */
@media (max-width: 1200px) {
    .brand-logo {
        width: 155px;
        height: 52px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .brand-logo {
        width: 145px;
        height: 48px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .brand-logo {
        width: 125px;
        height: 43px;
    }
}

/* Extra-small screens */
@media (max-width: 350px) {
    .brand-logo {
        width: 112px;
        height: 39px;
    }
}


/* Desktop navigation */
.menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: clamp(9px, 1.1vw, 18px);
    flex: 1 1 auto;
    min-width: 0;
}

.menu>a,
.menu>.dropdown>a {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 12px 0;
    color: #172033;
    font-size: clamp(11px, .88vw, 13px);
    font-weight: 600;
    line-height: 1.5;
    text-decoration: none;
    white-space: nowrap;
    transition: color .25s ease;
}

.menu>a::after,
.menu>.dropdown>a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 5px;
    width: 0;
    height: 2px;
    border-radius: 3px;
    background: #2563eb;
    transition: width .25s ease;
}

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

.menu>a:hover::after,
.menu>.dropdown>a:hover::after,
.menu>.dropdown:focus-within>a::after {
    width: 100%;
}

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

.menu>.dropdown>a i {
    font-size: 10px;
    transition: transform .2s ease;
}

.menu>.dropdown:hover>a i,
.menu>.dropdown:focus-within>a i {
    transform: rotate(180deg);
}

/* Desktop dropdown panels */
.dropdown-menu {
    position: absolute;
    top: calc(100% + 2px);
    left: 0;
    display: none;
    width: 235px;
    max-width: min(280px, 90vw);
    max-height: min(70vh, 450px);
    overflow-y: auto;
    margin: 0;
    padding: 8px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(17, 24, 39, .16);
    z-index: 1005;
    animation: cw-header-fade-in .18s 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;
    color: #334155;
    border-radius: 7px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.5;
    text-decoration: none;
    white-space: normal;
    transition: color .2s ease, background .2s ease;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus-visible {
    color: #1d4ed8;
    background: #eff6ff;
}

@keyframes cw-header-fade-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Logged-in user */
#logged-user {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    flex: 0 0 auto;
    padding: 8px 10px;
    color: #172033;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

#logged-user i {
    color: #2563eb;
    font-size: 16px;
}

#logged-user[style*="display:none"],
#logged-user[style*="display: none"] {
    display: none !important;
}

/* Hamburger button */
.hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    color: #172033;
    background: #f8fafc;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    font-size: 21px;
    cursor: pointer;
    transition: color .2s ease, background .2s ease, border-color .2s ease;
}

.hamburger:hover {
    color: #1d4ed8;
    background: #eff6ff;
    border-color: #93c5fd;
}

/* =========================================================
   MOBILE MENU
   Matches .mobile-menu, .mobile-header, .close-btn,
   .mobile-links and #mobileLinks from the supplied HTML.
========================================================= */

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    width: min(360px, 92vw);
    height: 100vh;
    height: 100dvh;
    padding: 0 18px 24px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    color: #172033;
    background: #fff;
    box-shadow: -12px 0 36px rgba(15, 23, 42, .2);
    transform: translateX(105%);
    visibility: hidden;
    pointer-events: none;
    transition: transform .32s ease, visibility .32s ease;
}

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

.mobile-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    margin: 0 -18px 14px;
    padding: 15px 18px;
    background: #fff;
    border-bottom: 1px solid #e2e8f0;
}

.close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 39px;
    height: 39px;
    color: #172033;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 9px;
    font-size: 21px;
    line-height: 1;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}

.close-btn:hover {
    color: #1d4ed8;
    background: #eff6ff;
}

.mobile-links {
    display: flex;
    flex-direction: column;
    gap: 3px;
    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 11px;
    color: #172033;
    background: transparent;
    border: 0;
    border-bottom: 1px solid #edf1f6;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.5;
    text-align: left;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
    transition: color .2s ease, background .2s ease;
}

.mobile-links>a:hover,
.mobile-links>.dropdown>a:hover {
    color: #1d4ed8;
    background: #eff6ff;
}

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

.mobile-links .dropdown>a i {
    transition: transform .2s ease;
}

.mobile-links .dropdown>a[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Existing mobile JavaScript can toggle .mobile-open */
.mobile-links .dropdown-menu {
    position: static !important;
    display: none !important;
    width: 100% !important;
    max-width: 100% !important;
    max-height: none !important;
    margin: 3px 0 8px !important;
    padding: 6px !important;
    overflow: visible !important;
    background: #f1f5f9 !important;
    border: 0 !important;
    border-radius: 8px !important;
    box-shadow: none !important;
    animation: none !important;
}

.mobile-links .dropdown-menu.mobile-open {
    display: block !important;
}

.mobile-links .dropdown-menu a {
    display: flex;
    width: 100%;
    padding: 10px 11px;
    color: #334155;
    border-bottom: 1px solid #dfe7f0;
    border-radius: 5px;
    font-size: 12px;
    line-height: 1.5;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

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

.mobile-links .dropdown-menu a:hover {
    color: #1d4ed8;
    background: #dbeafe;
}

/* =========================================================
   RESPONSIVE LAYOUT
========================================================= */

/* Smaller desktop / laptop */
@media (max-width: 1200px) and (min-width: 769px) {
    .navbar {
        gap: 12px;
        padding-right: 18px;
        padding-left: 18px;
    }

    .menu {
        gap: clamp(6px, .7vw, 10px);
    }

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

    .brand-icon {
        font-size: 33px;
    }

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

    .cw-topbar-inner {
        gap: 13px;
    }

    .cw-topbar-title {
        font-size: 11.5px;
    }

    .cw-topbar-social {
        gap: 2px;
    }

    .cw-topbar-social a {
        width: 31px;
        height: 34px;
        font-size: 15px;
    }

    .cw-topbar-actions {
        gap: 7px;
    }

    .cw-topbar-login,
    .cw-topbar-logout,
    .cw-topbar-hackathon {
        padding: 9px 11px;
        font-size: 10.5px;
    }
}

/* Tablet and mobile */
@media (max-width: 768px) {
    .navbar {
        min-height: 67px;
        gap: 12px;
        padding: 10px 16px;
    }

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

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

    .brand-icon {
        font-size: 33px;
    }

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

    .cw-topbar-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas:
            "identity social"
            "actions actions";
        gap: 11px 8px;
        padding: 12px 15px;
    }

    .cw-topbar-identity {
        grid-area: identity;
    }

    .cw-topbar-title {
        font-size: 11px;
    }

    .cw-topbar-social {
        grid-area: social;
        justify-self: end;
    }

    .cw-topbar-social a {
        width: 29px;
        height: 31px;
        font-size: 13px;
    }

    .cw-topbar-actions {
        grid-area: actions;
        justify-content: center;
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }

    .cw-topbar-login,
    .cw-topbar-logout,
    .cw-topbar-hackathon {
        min-height: 36px;
        padding: 8px 12px;
        font-size: 10.5px;
    }
}

@media (max-width: 480px) {
    .cw-topbar-inner {
        gap: 10px 4px;
        padding: 11px 10px;
    }

    .cw-topbar-title {
        font-size: 10px;
    }

    .cw-topbar-social {
        gap: 0;
    }

    .cw-topbar-social a {
        width: 27px;
        height: 29px;
        font-size: 12px;
    }

    .cw-topbar-actions {
        gap: 6px;
    }

    .cw-topbar-login,
    .cw-topbar-logout,
    .cw-topbar-hackathon {
        gap: 5px;
        min-height: 34px;
        padding: 8px 9px;
        font-size: 10px;
    }

    .navbar {
        padding: 9px 12px;
    }

    .brand-icon {
        font-size: 29px;
    }

    .brand-text {
        font-size: 10px;
        letter-spacing: 1.7px;
    }

    .hamburger {
        width: 39px;
        height: 39px;
        font-size: 20px;
    }

    .mobile-menu {
        width: min(360px, 94vw);
        padding-right: 15px;
        padding-left: 15px;
    }

    .mobile-header {
        margin-right: -15px;
        margin-left: -15px;
        padding-right: 15px;
        padding-left: 15px;
    }
}

@media (max-width: 350px) {
    .cw-topbar-title {
        font-size: 9.5px;
    }

    .cw-topbar-social a {
        width: 24px;
    }

    .cw-topbar-login,
    .cw-topbar-logout,
    .cw-topbar-hackathon {
        padding: 7px 8px;
        font-size: 9.5px;
    }

    .brand-icon {
        font-size: 26px;
    }

    .brand-text {
        font-size: 9px;
        letter-spacing: 1.3px;
    }

    .hamburger {
        width: 38px;
        height: 38px;
    }
}

/* Accessibility */
.cw-topbar a:focus-visible,
.menu a:focus-visible,
.mobile-links a:focus-visible,
.hamburger:focus-visible,
.close-btn:focus-visible {
    outline: 2px solid #60a5fa;
    outline-offset: 3px;
}

@keyframes cw-topbar-pulse {
    0% {
        transform: scale(.7);
        opacity: .8;
    }

    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .cw-topbar-indicator::after {
        animation: none !important;
    }

    .cw-topbar *,
    .navbar *,
    .mobile-menu *,
    .cw-topbar a,
    .brand,
    .menu a,
    .dropdown-menu {
        transition: none !important;
        animation: none !important;
    }
}