/* =========================================================
   TYPECLIMB HEADER
========================================================= */

:root {

    --header-bg: var(--tc-surface);
    --header-border: var(--tc-border);

    --text-primary: var(--tc-text);
    --text-secondary: var(--tc-text-secondary);
    --text-muted: var(--tc-text-muted);

    --primary: var(--tc-primary);
    --primary-dark: var(--tc-primary-dark);

    --hover-bg: var(--tc-hover);

    --danger: var(--tc-danger);

    --header-height: 70px;
}


/* =========================================================
   RESET
========================================================= */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;

    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        Inter,
        Arial,
        sans-serif;

    color: var(--text-primary);
    background: var(--tc-bg);
}


/* =========================================================
   HEADER
========================================================= */

.mainHeader {
    position: sticky;
    top: 0;
    z-index: 1000;

    background: var(--header-bg);

    border-bottom: 1px solid var(--header-border);

    box-shadow: var(--tc-shadow);
}


/* =========================================================
   HEADER CONTAINER
========================================================= */

.headerContainer {
    width: 100%;
    max-width: 1200px;

    min-height: var(--header-height);

    margin: 0 auto;
    padding: 0 24px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 24px;
}


/* =========================================================
   BRAND
========================================================= */

.brand-logo {
    display: inline-flex;
    align-items: center;

    gap: 9px;

    text-decoration: none;

    flex-shrink: 0;
}

.brand-logo-image {
    width: 42px;
    height: 42px;

    object-fit: contain;

    display: block;
}

.brand-logo-text {
    font-size: 1.35rem;
    font-weight: 750;

    letter-spacing: -0.4px;

    color: var(--text-primary);

    white-space: nowrap;
}


/* =========================================================
   HEADER MENU
========================================================= */

.header-menu {
    display: flex;
    align-items: center;

    gap: 28px;

    margin-left: auto;
}


/* =========================================================
   NAVIGATION
========================================================= */

.nav ul {
    list-style: none;

    display: flex;
    align-items: center;

    gap: 28px;
}

.nav a {
    position: relative;

    display: inline-block;

    color: var(--text-secondary);

    text-decoration: none;

    font-size: 15px;
    font-weight: 500;

    padding: 8px 0;

    transition:
        color 0.25s ease;
}

.nav a::after {
    content: "";

    position: absolute;

    left: 0;
    bottom: 0;

    width: 0;
    height: 2px;

    background: var(--primary);

    border-radius: 2px;

    transition: width 0.25s ease;
}

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

.nav a:hover::after {
    width: 100%;
}


/* =========================================================
   HEADER ACTIONS
========================================================= */

.header-actions {
    display: flex;
    align-items: center;

    gap: 8px;
}


/* =========================================================
   ICON BUTTON
========================================================= */

.header-icon {
    position: relative;

    width: 40px;
    height: 40px;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    border-radius: 10px;

    background: transparent;

    border: 1px solid transparent;

    color: var(--text-secondary);

    cursor: pointer;

    text-decoration: none;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        transform 0.2s ease,
        border-color 0.2s ease;
}

.header-icon:hover {
    background: var(--hover-bg);

    border-color: var(--tc-border);

    color: var(--primary);

    transform: translateY(-1px);
}

.header-icon:active {
    transform: scale(0.95);
}


/* SVG */

.header-icon .icon {
    width: 20px;
    height: 20px;

    fill: currentColor;

    transition:
        color 0.2s ease;
}


/* =========================================================
   NOTIFICATION BADGE
========================================================= */

.notification-badge {
    position: absolute;

    top: -3px;
    right: -3px;

    min-width: 17px;
    height: 17px;

    padding: 0 4px;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 999px;

    background: #ef4444;
    color: #ffffff;

    font-size: 10px;
    font-weight: 700;

    line-height: 1;
}


/* =========================================================
   DARK MODE ACTIVE
========================================================= */

.header-icon.active {
    background: var(--tc-hover);
    color: var(--primary);
}

.header-icon.active .icon {
    fill: currentColor;
}


/* =========================================================
   AUTH BUTTONS
========================================================= */

.auth-container {
    display: flex;
    align-items: center;

    gap: 10px;
}

.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;

    padding: 7px 17px;

    border-radius: 999px;

    text-decoration: none;

    font-size: 14px;
    font-weight: 600;

    white-space: nowrap;

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

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


/* Login */

.login {
    background: var(--tc-surface);

    color: var(--primary);

    border: 1.5px solid var(--primary);
}

.login:hover {
    background: var(--primary);
    color: #ffffff;
}


/* Sign Up */

.signup {
    background: var(--primary);

    color: #ffffff;

    border: 1.5px solid var(--primary);
}

.signup:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}


/* =========================================================
   PROFILE
========================================================= */

.profile-wrapper {
    position: relative;
}


/* Profile button */

.profile-box {
    display: flex;
    align-items: center;

    gap: 10px;

    padding: 5px 10px 5px 5px;

    background: transparent;

    border: 1px solid transparent;

    border-radius: 40px;

    cursor: pointer;

    transition:
        background 0.2s ease,
        border-color 0.2s ease;
}

.profile-box:hover {
    background: var(--hover-bg);

    border-color: var(--tc-border);
}


/* Avatar */

.avatar {
    width: 40px;
    height: 40px;

    flex-shrink: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    border-radius: 50%;

    background: var(--primary);

    color: #ffffff;

    font-size: 15px;
    font-weight: 700;

    overflow: hidden;
}

.avatar img {
    width: 100%;
    height: 100%;

    object-fit: cover;
}


/* Profile information */

.profile-info {
    min-width: 0;
}

.profile-info .profile-name {
    max-width: 130px;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;

    color: var(--text-primary);

    font-size: 14px;
    font-weight: 600;
}

.profile-info .profile-lastlogin {
    max-width: 150px;

    overflow: hidden;

    text-overflow: ellipsis;
    white-space: nowrap;

    color: var(--text-muted);

    font-size: 11px;
}


/* =========================================================
   PROFILE DROPDOWN
========================================================= */

.profile-dropdown {
    position: absolute;

    top: calc(100% + 8px);
    right: 0;

    width: 210px;

    padding: 8px 0;

    background: var(--tc-surface);

    border: 1px solid var(--tc-border);

    border-radius: 12px;

    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.10);

    opacity: 0;
    visibility: hidden;

    transform: translateY(8px);

    transition:
        opacity 0.2s ease,
        visibility 0.2s ease,
        transform 0.2s ease;

    z-index: 1100;
}

.profile-dropdown.active {
    opacity: 1;

    visibility: visible;

    transform: translateY(0);
}

.profile-dropdown a {
    display: block;

    padding: 10px 16px;

    color: var(--text-secondary);

    font-size: 14px;

    text-decoration: none;

    transition:
        background 0.2s ease,
        color 0.2s ease;
}

.profile-dropdown a:hover {
    background: var(--hover-bg);

    color: var(--primary);
}

.dropdown-divider {
    height: 1px;

    margin: 6px 0;

    background: var(--tc-border);
}

.profile-dropdown .logout {
    color: var(--danger);
}

.profile-dropdown .logout:hover {
    background: var(--tc-danger-hover);
    color: var(--danger);
}


/* =========================================================
   MOBILE MENU BUTTON
========================================================= */

.mobile-menu-toggle {
    display: none;

    width: 42px;
    height: 42px;

    padding: 0;

    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 5px;

    background: transparent;

    border: 1px solid var(--tc-border);

    border-radius: 10px;

    cursor: pointer;
}

.mobile-menu-toggle span {
    width: 19px;
    height: 2px;

    background: var(--text-secondary);

    border-radius: 2px;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}


/* Hamburger -> X */

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

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

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


/* =========================================================
   TABLET
========================================================= */

@media (max-width: 1100px) {

    .headerContainer {
        padding: 0 18px;
    }

    .header-menu {
        gap: 18px;
    }

    .nav ul {
        gap: 18px;
    }

    .profile-info {
        display: none;
    }

    .profile-box {
        padding-right: 5px;
    }
}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 768px) {

    .headerContainer {
        min-height: 64px;

        padding: 8px 16px;

        position: relative;
    }


    /* Brand */

    .brand-logo-image {
        width: 40px;
        height: 40px;
    }

    .brand-logo-text {
        font-size: 1.2rem;
    }


    /* Hamburger */

    .mobile-menu-toggle {
        display: flex;
    }


    /* Menu */

    .header-menu {
        position: absolute;

        top: calc(100% + 1px);
        left: 0;
        right: 0;

        display: flex;
        flex-direction: column;
        align-items: stretch;

        gap: 0;

        margin: 0;

        padding: 14px 16px 18px;

        background: var(--tc-surface);

        border-bottom: 1px solid var(--tc-border);

        box-shadow:
            0 12px 25px rgba(0, 0, 0, 0.08);

        opacity: 0;
        visibility: hidden;

        transform: translateY(-8px);

        transition:
            opacity 0.2s ease,
            visibility 0.2s ease,
            transform 0.2s ease;
    }

    .header-menu.mobile-open {
        opacity: 1;

        visibility: visible;

        transform: translateY(0);
    }


    /* Navigation */

    .nav {
        width: 100%;
    }

    .nav ul {
        width: 100%;

        display: flex;
        flex-direction: column;
        align-items: stretch;

        gap: 2px;
    }

    .nav li {
        width: 100%;
    }

    .nav a {
        display: block;

        width: 100%;

        padding: 12px 10px;

        border-radius: 8px;
    }

    .nav a:hover {
        background: var(--hover-bg);
    }

    .nav a::after {
        display: none;
    }


    /* Header actions */

    .header-actions {
        width: 100%;

        padding: 12px 0;

        margin-top: 8px;

        border-top: 1px solid var(--tc-border);

        justify-content: flex-start;
    }

    .header-icon {
        width: 40px;
        height: 40px;
    }


    /* Auth */

    .auth-container {
        width: 100%;

        padding-top: 12px;

        border-top: 1px solid var(--tc-border);
    }

    .auth-btn {
        flex: 1;
    }


    /* Profile */

    .profile-wrapper {
        width: 100%;

        padding-top: 12px;

        border-top: 1px solid var(--tc-border);
    }

    .profile-box {
        width: 100%;

        justify-content: flex-start;

        padding: 6px;

        border: 0;
    }

    .profile-info {
        display: block;
    }

    .profile-info .profile-name,
    .profile-info .profile-lastlogin {
        max-width: none;
    }


    /* Dropdown */

    .profile-dropdown {
        position: static;

        width: 100%;

        margin-top: 6px;

        box-shadow: none;

        border: 1px solid var(--tc-border);
    }
}


/* =========================================================
   SMALL MOBILE
========================================================= */

@media (max-width: 420px) {

    .headerContainer {
        padding-left: 12px;
        padding-right: 12px;
    }

    .brand-logo-image {
        width: 36px;
        height: 36px;
    }

    .brand-logo-text {
        font-size: 1.1rem;
    }
}


/* =========================================================
   VERY SMALL SCREENS
========================================================= */

@media (max-width: 340px) {

    .brand-logo-text {
        display: none;
    }
}