/* 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: calc(100% - 24px);
    max-width: none;
    margin: 0 auto;
}

.header-container {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    gap: 1.5rem;
}

.header-actions {
    justify-self: end;
    display: center;
    align-items: center;
    gap: 0.25rem;
    margin-right: 0;
}

/* LOGO */

.logo {
    justify-self: start;
}

.logo h1 {
    margin: 0; 
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--color-text);
    white-space: nowrap;
}

/* NAV */

.nav {
    /* margin-left: 588px; */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    width: 100%;
    margin: 0 auto;
    justify-self: center;
}

.nav-list {
    display: flex;
    grid-template-columns: max-content max-content 10px max-content max-content;
    align-items: center;
    column-gap: 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);
}

/* =========================
   RESPONSIVIDADE HEADER
========================= */

@media (max-width: 1280px) {
    .header .container {
        width: calc(100% - 20px);
    }

    .nav-list {
        grid-template-columns: max-content max-content 24px max-content max-content;
        column-gap: 1.15rem;
    }

    .nav-list a {
        font-size: 0.92rem;
    }

    .logo h1 {
        font-size: 1.08rem;
    }
}

@media (max-width: 1080px) {
    .header {
        padding: 0.2rem 0;
    }

    .header .container {
        width: calc(100% - 16px);
    }

    .header-container {
        gap: 0.9rem;
    }

    .nav-list {
        grid-template-columns: max-content max-content 14px max-content max-content;
        column-gap: 0.9rem;
    }

    .nav-list a {
        font-size: 0.86rem;
    }

    .logo h1 {
        font-size: 1rem;
    }

    .header-actions {
        gap: 0.2rem;
    }

    .theme-toggle {
        gap: 0.4rem;
    }

    .toggle-track {
        width: 52px;
        height: 28px;
    }

    .toggle-thumb {
        width: 20px;
        height: 20px;
    }

    .toggle-state:checked ~ .toggle-track .toggle-thumb {
        transform: translateX(24px);
    }

    .lang-current {
        min-width: 70px;
        padding: 0.24rem 0.4rem;
        font-size: 0.66rem;
        gap: 0.35rem;
    }

    .lang-dropdown {
        min-width: 150px;
    }
}

@media (max-width: 900px) {
    .header {
        padding: 0.35rem 0;
    }

    .header .container {
        width: calc(100% - 14px);
    }

    .header-container {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 0.7rem;
    }

    .logo {
        justify-self: center;
    }

    .nav {
        position: static;
        left: auto;
        transform: none;
        width: 100%;
        display: flex;
        justify-content: center;
        order: 2;
    }

    .nav-list {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.75rem 1rem;
    }

    .nav-list li {
        grid-column: auto !important;
    }

    .header-actions {
        justify-self: center;
        order: 3;
        margin-right: 0;
        gap: 0.3rem;
    }
}

@media (max-width: 576px) {
    .header .container {
        width: calc(100% - 12px);
    }

    .logo h1 {
        font-size: 0.95rem;
        text-align: center;
    }

    .nav {
        width: 100%;
    }

    .nav-list {
        gap: 0.55rem 0.85rem;
    }

    .nav-list a {
        font-size: 0.82rem;
        padding: 0.18rem 0.12rem;
    }

    .theme-toggle {
        gap: 0.35rem;
    }

    .toggle-icon {
        width: 16px;
        height: 16px;
    }

    .toggle-track {
        width: 48px;
        height: 26px;
    }

    .toggle-thumb {
        top: 3px;
        left: 3px;
        width: 18px;
        height: 18px;
    }

    .toggle-state:checked ~ .toggle-track .toggle-thumb {
        transform: translateX(22px);
    }

    .lang-current {
        min-width: 66px;
        padding: 0.22rem 0.35rem;
        font-size: 0.64rem;
        gap: 0.32rem;
    }

    .flag {
        width: 16px;
        height: 11px;
    }

    .lang-dropdown {
        min-width: 142px;
        right: 50%;
        transform: translate(50%, -4px);
    }

    .language-switcher:hover .lang-dropdown,
    .language-switcher:focus-within .lang-dropdown {
        transform: translate(50%, 0);
    }

    .lang-option {
        font-size: 0.67rem;
        padding: 0.4rem 0.48rem;
    }
}

@media (max-width: 380px) {
    .header {
        padding: 0.45rem 0;
    }

    .nav-list {
        gap: 0.45rem 0.7rem;
    }

    .nav-list a {
        font-size: 0.78rem;
    }

    .header-actions {
        flex-wrap: wrap;
        justify-content: center;
    }
}