/* css/smi-nav.css
 * Nav header reescrito do zero (2026-05-13). Substitui CSS antigo de .main-navigation/.nav-dropdown.
 * Comportamento:
 *   Desktop (>=920px): items inline + 1 dropdown "Mais Ferramentas".
 *   Mobile (<920px): items + dropdown empilhados dentro de hamburger panel.
 *   Open state SOMENTE via classe .is-open (NUNCA server-rendered).
 */

/* ============================================================
   Estrutura do header
   ============================================================ */
.smi-header {
    position: fixed;
    top: 30px; /* abaixo do microheader 30px */
    left: 0;
    right: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 2px 12px rgba(15, 23, 42, 0.08);
}

.smi-header__inner {
    max-width: 1700px;
    margin: 0 auto;
    padding: 0.85rem clamp(24px, 4vw, 56px);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.smi-header__logo {
    color: #0071e3;
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    text-decoration: none;
    flex-shrink: 0;
    transition: transform 0.2s ease, color 0.2s ease;
}
.smi-header__logo:hover {
    transform: translateY(-1px);
    color: #003c87;
}

/* ============================================================
   Nav (lista de itens)
   ============================================================ */
.smi-nav {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 1 1 auto;
    min-width: 0;
    list-style: none;
    padding: 0;
    margin: 0;
}

.smi-nav__item {
    position: relative;
    list-style: none;
}

.smi-nav__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.92rem;
    line-height: 1.15;
    color: #334155;
    text-decoration: none;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    white-space: nowrap;
}
.smi-nav__link i.fas {
    font-size: 0.9em;
    color: inherit;
}
.smi-nav__link:hover {
    color: #0071e3;
    background: rgba(0, 113, 227, 0.08);
}
.smi-nav__link.is-active {
    color: #0071e3;
    background: rgba(0, 113, 227, 0.10);
    font-weight: 600;
}

.smi-nav__caret {
    margin-left: 2px;
    font-size: 0.75em;
    transition: transform 0.2s ease;
}
.smi-nav__item.is-open > .smi-nav__link .smi-nav__caret {
    transform: rotate(180deg);
}

/* ============================================================
   Dropdown
   ============================================================ */
.smi-nav__dropdown {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 280px;
    max-width: 92vw;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    overscroll-behavior: contain;
    background: #ffffff;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: 10px;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18), 0 2px 6px rgba(15, 23, 42, 0.08);
    padding: 10px;
    list-style: none;
    margin: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px);
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
}
.smi-nav__item.is-open > .smi-nav__dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.smi-nav__group-title {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
    padding: 8px 12px 4px;
    font-weight: 700;
    list-style: none;
}

.smi-nav__sep {
    border-top: 1px solid #e2e8f0;
    margin: 8px 0;
    list-style: none;
}

.smi-nav__dropdown-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 6px;
    color: #334155;
    font-weight: 500;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.18s ease, color 0.18s ease;
}
.smi-nav__dropdown-link i.fas {
    color: #0071e3;
    font-size: 0.95em;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}
.smi-nav__dropdown-link:hover {
    background: rgba(0, 113, 227, 0.08);
    color: #0071e3;
}
.smi-nav__dropdown-link.is-active {
    background: rgba(0, 113, 227, 0.10);
    color: #0071e3;
    font-weight: 600;
}

/* ============================================================
   Header actions (right side)
   ============================================================ */
.smi-header__actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.smi-header__theme-toggle,
.smi-header__burger {
    background: transparent;
    border: 0;
    color: #334155;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.18s ease, color 0.18s ease;
}
.smi-header__theme-toggle:hover,
.smi-header__burger:hover {
    background: rgba(0, 113, 227, 0.08);
    color: #0071e3;
}

.smi-header__burger {
    display: none; /* mostrado em mobile */
}
.smi-header__burger-line {
    display: block;
    width: 20px;
    height: 2px;
    background: currentColor;
    margin: 3px 0;
    border-radius: 2px;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.smi-header__burger.is-open .smi-header__burger-line:nth-child(1) {
    transform: translateY(5px) rotate(45deg);
}
.smi-header__burger.is-open .smi-header__burger-line:nth-child(2) {
    opacity: 0;
}
.smi-header__burger.is-open .smi-header__burger-line:nth-child(3) {
    transform: translateY(-5px) rotate(-45deg);
}

/* ============================================================
   Dark mode
   ============================================================ */
body.dark-mode .smi-header {
    background: rgba(15, 23, 42, 0.92);
    border-bottom-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.3);
}
body.dark-mode .smi-header__logo {
    color: #7dd3fc;
}
body.dark-mode .smi-nav__link {
    color: #d7dde7;
}
body.dark-mode .smi-nav__link:hover,
body.dark-mode .smi-nav__link.is-active {
    color: #7dd3fc;
    background: rgba(125, 211, 252, 0.12);
}
body.dark-mode .smi-nav__dropdown {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.08);
}
body.dark-mode .smi-nav__dropdown-link {
    color: #e2e8f0;
}
body.dark-mode .smi-nav__dropdown-link i.fas {
    color: #7dd3fc;
}
body.dark-mode .smi-nav__group-title {
    color: #94a3b8;
}
body.dark-mode .smi-nav__sep {
    border-top-color: rgba(255, 255, 255, 0.08);
}
body.dark-mode .smi-header__theme-toggle,
body.dark-mode .smi-header__burger {
    color: #d7dde7;
}

/* ============================================================
   Mobile (<920px)
   ============================================================ */
@media (max-width: 920px) {
    .smi-header__burger {
        display: inline-flex;
    }
    .smi-nav {
        position: fixed !important;
        top: 94px !important;
        right: 0 !important;
        bottom: auto !important;
        left: auto !important;
        width: min(320px, 88vw) !important;
        height: calc(100vh - 94px) !important;
        flex: 0 0 auto !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 4px !important;
        padding: 16px !important;
        margin: 0 !important;
        background: #ffffff !important;
        border-left: 1px solid rgba(15, 23, 42, 0.08) !important;
        box-shadow: -8px 0 24px rgba(15, 23, 42, 0.12) !important;
        overflow-y: auto !important;
        overscroll-behavior: contain !important;
        transform: translateX(110%) !important;
        transition: transform 0.25s ease;
        z-index: 999 !important;
    }
    .smi-nav.is-open {
        transform: translateX(0) !important;
    }
    .smi-nav.is-open {
        transform: translateX(0);
    }
    .smi-nav__link {
        width: 100%;
        justify-content: flex-start;
        padding: 12px 14px;
    }
    .smi-nav__dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border: 0;
        border-left: 2px solid #e2e8f0;
        border-radius: 0;
        margin: 4px 0 8px 12px;
        padding: 4px 0 4px 12px;
        max-height: none;
        min-width: 0;
        display: none;
    }
    .smi-nav__item.is-open > .smi-nav__dropdown {
        display: block;
    }
    body.dark-mode .smi-nav {
        background: #1e293b;
        border-left-color: rgba(255, 255, 255, 0.08);
    }
    body.dark-mode .smi-nav__dropdown {
        border-left-color: rgba(255, 255, 255, 0.12);
    }
}

/* Bloqueia scroll do body quando nav mobile aberto */
body.smi-nav-is-open {
    overflow: hidden;
}

/* Print: oculta nav */
@media print {
    .smi-header { display: none; }
}
