/* ============== Hamburger toggle (3 barras) ============== */
.floating-menu-toggle {
    width: 36px;
    height: 36px;
    border: 0;
    background: transparent;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    margin-right: 0.4rem;
    flex-shrink: 0;
    transition: background-color 0.15s ease;
}

.floating-menu-toggle:hover,
.floating-menu-toggle:focus-visible {
    background: rgba(13, 23, 48, 0.06);
    outline: none;
}

.floating-menu-toggle__bar {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 2px;
    color: var(--ink-900, #0d1730);
    transition: transform 0.2s ease, opacity 0.2s ease;
}

/* Animacao em "X" quando aberto */
.floating-menu-toggle[aria-expanded="true"] .floating-menu-toggle__bar:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.floating-menu-toggle[aria-expanded="true"] .floating-menu-toggle__bar:nth-child(2) {
    opacity: 0;
}

.floating-menu-toggle[aria-expanded="true"] .floating-menu-toggle__bar:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

html[data-theme="dark"] .floating-menu-toggle__bar {
    color: #e8eef7;
}

html[data-theme="dark"] .floating-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.08);
}

/* ============== Icone de engrenagem (admin) ============== */
.header-admin-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    margin: 0 0.35rem 0 0.1rem;
    border-radius: 999px;
    color: var(--ink-700, #3c4c61);
    background: transparent;
    border: 1px solid transparent;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    text-decoration: none;
    flex-shrink: 0;
}

.header-admin-link:hover,
.header-admin-link:focus-visible {
    background: #eef4fb;
    color: var(--ink-900, #0d1730);
    border-color: #d2ddea;
    outline: none;
}

html[data-theme="dark"] .header-admin-link {
    color: #c5d2e3;
}

html[data-theme="dark"] .header-admin-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f0f6ff;
    border-color: rgba(255, 255, 255, 0.18);
}

/* ============== Backdrop (fundo escuro quando menu aberto) ============== */
.floating-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 19, 37, 0.45);
    z-index: 9998;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.floating-menu-backdrop.is-visible {
    opacity: 1;
    pointer-events: auto;
}

/* ============== Painel flutuante (sidebar vertical) ============== */
.floating-menu {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 9999;
    width: min(85vw, 320px);
    background: #ffffff;
    color: #1f2f47;
    box-shadow: 4px 0 24px rgba(8, 19, 37, 0.22);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.floating-menu.is-open {
    transform: translateX(0);
}

.floating-menu[hidden] {
    /* Override do hidden quando estamos animando — controlado por JS via classe is-open */
    display: flex !important;
}

.floating-menu__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.1rem;
    border-bottom: 1px solid #e3e9f1;
    background: #f8fafd;
    flex-shrink: 0;
}

.floating-menu__title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #0d1730;
    letter-spacing: 0.02em;
}

.floating-menu__close {
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #3c4c61;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}

.floating-menu__close:hover,
.floating-menu__close:focus-visible {
    background: #eef4fb;
    color: #0d1730;
    outline: none;
}

.floating-menu__nav {
    flex: 1;
    overflow-y: auto;
    padding: 0.45rem 0;
    display: flex;
    flex-direction: column;
}

.floating-menu__link {
    padding: 0.7rem 1.1rem;
    font-size: 0.95rem;
    color: #1f2f47;
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease;
    line-height: 1.35;
}

.floating-menu__link:hover {
    background: #eef4fb;
    color: #0d1730;
    border-left-color: #1f6cb6;
}

.floating-menu__link.is-active {
    background: #e4effb;
    color: #0d1730;
    font-weight: 700;
    border-left-color: #0d1730;
}

/* Dark theme do painel */
html[data-theme="dark"] .floating-menu {
    background: #11192c;
    color: #d8e3f1;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.45);
}

html[data-theme="dark"] .floating-menu__header {
    background: rgba(255, 255, 255, 0.03);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

html[data-theme="dark"] .floating-menu__title {
    color: #f0f6ff;
}

html[data-theme="dark"] .floating-menu__close {
    color: #c5d2e3;
}

html[data-theme="dark"] .floating-menu__close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f0f6ff;
}

html[data-theme="dark"] .floating-menu__link {
    color: #d8e3f1;
}

html[data-theme="dark"] .floating-menu__link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #f0f6ff;
    border-left-color: #7fc7ff;
}

html[data-theme="dark"] .floating-menu__link.is-active {
    background: rgba(127, 199, 255, 0.18);
    color: #f0f6ff;
    border-left-color: #7fc7ff;
}

/* ============== Esconder a antiga main-nav caso ainda esteja em algum lugar ============== */
.main-nav {
    display: none !important;
}

/* Lock do scroll quando menu aberto */
body.floating-menu-open {
    overflow: hidden;
}
