/* HEADER BASE */

.header {
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: rgba(22, 22, 22, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    overflow: visible;
}

/* CONTAINER */

.header .container {
    width: min(100% - 1.5rem, var(--container-width));
    margin: 0 auto;
}

.header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    gap: clamp(0.75rem, 2vw, 1.5rem);
}

/* LOGO */

.logo {
    justify-self: start;
}

.logo h1 {
    margin: 0; 
    font-size: clamp(1rem, 2vw, 1.2rem);
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}

/* NAV */

.nav {
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    width: 100%;
    margin: 0 auto;
    justify-self: center;
}

.nav-list {
    display: flex;
    align-items: center;
    column-gap: clamp(1rem, 2.5vw, 1.8rem);
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-list a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.15rem;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--color-text);
    position: relative;
    white-space: nowrap;
    transition: var(--transition-default);
}

.nav-list a::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0%;
    height: 2px;
    background-color: var(--color-accent);
    transition: var(--transition-default);
}

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

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

/* RIGHT SIDE */

.header-actions {
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0;
}

/* THEME TOGGLE */

.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
    cursor: pointer;
    user-select: none;
}

.toggle-state {
    display: none;
}

.toggle-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    color: rgba(255, 255, 255, 0.65);
    transition: color 0.25s ease, transform 0.25s ease, opacity 0.25s ease;
}

.toggle-icon svg {
    width: 100%;
    height: 100%;
}

.toggle-track {
    position: relative;
    width: 58px;
    height: 30px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.03),
        0 0 16px rgba(251, 4, 124, 0.10);
    transition: background 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(180deg, #ffffff 0%, #f3f3f3 100%);
    box-shadow:
        0 4px 10px rgba(0, 0, 0, 0.22),
        0 0 14px rgba(255, 255, 255, 0.14);
    transition: transform 0.35s cubic-bezier(0.85, 0.05, 0.18, 1.35);
}

.toggle-state:checked ~ .toggle-track .toggle-thumb {
    transform: translateX(28px);
}

.toggle-state:checked ~ .toggle-icon-sun {
    color: #f5a623;
    opacity: 1;
    transform: scale(1.05);
}

.toggle-state:checked ~ .toggle-track {
    background: rgba(245, 166, 35, 0.12);
    border-color: rgba(245, 166, 35, 0.28);
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.04),
        0 0 16px rgba(245, 166, 35, 0.12);
}

.toggle-state:not(:checked) ~ .toggle-icon-moon {
    color: #cfd6ff;
    opacity: 1;
    transform: scale(1.05);
}

/* LANGUAGE SWITCHER */

.language-switcher {
    position: relative;
    display: inline-flex;
    align-items: center;
    padding-bottom: 12px;
    margin-bottom: -12px;
}

.language-switcher::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 0;
    width: 100%;
    height: 12px; /* fecha o buraco entre botão e dropdown */
}

.lang-current {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 74px;
    padding: 0.28rem 0.45rem;
    border-radius: 0.4rem;
    font-size: 0.7rem;
    font-weight: 600;
    line-height: 1;
    background: rgba(255,255,255,0.05);
    color: var(--color-text);
    cursor: pointer;
    transition: 0.2s ease;
}

.lang-current:hover {
    background: rgba(251, 4, 124, 0.18);
}

.lang-current-flag,
.lang-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.flag {
    width: 18px;
    height: 13px;
    display: block;
    border-radius: 2px;
    overflow: hidden;
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 2px);
    right: 0;
    min-width: 156px;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.38rem;
    border-radius: 0.55rem;
    background: rgba(22,22,22,0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.06);
    box-shadow: 0 12px 30px rgba(0,0,0,0.26);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 1100;
}

.language-switcher:hover .lang-dropdown,
.language-switcher:focus-within .lang-dropdown {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.lang-option {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    width: 100%;
    padding: 0.42rem 0.52rem;
    border-radius: 0.4rem;
    font-size: 0.72rem;
    font-weight: 500;
    text-align: center;
    background: transparent;
    color: var(--color-text);
    cursor: pointer;
    transition: 0.2s ease;
}

.lang-option:hover {
    background: rgba(251, 4, 124, 0.18);
}

.menu-toggle {
    display: none;
}

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

@media (max-width: 768px) {

    /* GRID vira flex */
    .header-container {
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

    /* NAV vira menu mobile */
    .nav {
        position: fixed;
        top: 72px;
        left: 0;
        width: 100%;
        height: calc(100vh - 72px);

        background: rgba(10, 10, 10, 0.96);
        backdrop-filter: blur(14px);

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

        opacity: 0;
        pointer-events: none;
        transform: translateY(-10px);
        transition: 0.3s ease;

        z-index: 999;
    }

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

    /* LISTA VERTICAL */
    .nav-list {
        flex-direction: column;
        gap: 2rem;
    }

    .nav-list a {
        font-size: 1.2rem;
    }

    /* ESCONDE COISAS PESADAS */
    .language-switcher {
        display: none;
    }

    /* MENU TOGGLE VISÍVEL */
    .menu-toggle {
        display: flex;
        flex-direction: column;
        justify-content: center;
        gap: 5px;

        width: 28px;
        height: 24px;

        background: none;
        border: none;
        cursor: pointer;
        z-index: 1001;
    }

    .menu-toggle span {
        width: 100%;
        height: 2px;
        background: #ECECEC;
        transition: 0.3s ease;
    }

    /* ANIMAÇÃO X */
    .menu-toggle.active span:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

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

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

}