/* =====================================================================
   FreePix App — Gaveta lateral estilo Android (navigation drawer)
   Aditivo e isolado: este arquivo so adiciona o menu lateral.
   Pra desfazer 100%: remover o <link> deste css + o markup no _base.html.
   Combina com o tema PixPro (claro, azul corporativo).
   ===================================================================== */

/* ---- Com a gaveta lateral, a barra de links horizontal da topbar vira
        redundante. Escondemos em qualquer tamanho de tela; a navegacao
        passa a ser 100% pela gaveta (desktop) + bottom-nav (mobile). ---- */
.app-topbar-links { display: none !important; }

/* ---- Botao hamburguer na topbar (topbar e escura/navy, icone branco) ---- */
.app-drawer-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    margin-right: 4px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease;
}
.app-drawer-toggle:hover {
    background: rgba(255, 255, 255, 0.20);
    border-color: rgba(255, 255, 255, 0.40);
}
.app-drawer-toggle svg { width: 22px; height: 22px; }

/* ---- Scrim (fundo escurecido) ---- */
.app-drawer-scrim {
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(2, 6, 18, 0.50);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    transition: opacity 220ms ease;
}
.app-drawer-scrim.is-open { opacity: 1; }

/* ---- Painel da gaveta ---- */
.app-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 200;
    width: 86vw;
    max-width: 312px;
    display: flex;
    flex-direction: column;
    background: var(--bg-card-solid, #ffffff);
    border-right: 1px solid var(--border, #e5e7eb);
    box-shadow: 24px 0 60px rgba(15, 23, 42, 0.22);
    transform: translateX(-104%);
    transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
    overflow: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}
.app-drawer.is-open { transform: translateX(0); }

/* ---- Cabecalho (mesmo gradiente navy->azul da topbar PixPro) ---- */
.app-drawer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 18px 16px;
    background: linear-gradient(135deg, #001b58 0%, #003b9a 55%, #0078d7 100%);
}
.app-drawer-brand { display: inline-flex; align-items: center; }
.app-drawer-logo { height: 30px; display: block; }
.app-drawer-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.10);
    color: #ffffff;
    cursor: pointer;
    transition: background 140ms ease;
}
.app-drawer-close:hover { background: rgba(255, 255, 255, 0.22); }
.app-drawer-close svg { width: 20px; height: 20px; }

/* ---- Cartao do usuario ---- */
.app-drawer-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border-soft, #edf2f7);
}
.app-drawer-avatar {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: "Sora", sans-serif;
    font-weight: 800;
    font-size: 1.15rem;
    color: #ffffff;
    background: linear-gradient(135deg, #0078d7, #002a80);
    box-shadow: 0 4px 14px rgba(0, 120, 215, 0.30);
}
.app-drawer-user-text { min-width: 0; }
.app-drawer-email {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary, #0f172a);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}
.app-drawer-role {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--brand, #0078d7);
    font-weight: 800;
}

/* ---- Lista de atalhos ---- */
.app-drawer-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.app-drawer-section {
    padding: 14px 12px 6px;
    font-size: 0.66rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-muted, #64748b);
}
.app-drawer-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--text-secondary, #334155);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 600;
    position: relative;
    transition: background 140ms ease, color 140ms ease;
}
.app-drawer-item svg {
    width: 22px;
    height: 22px;
    flex: 0 0 auto;
    color: var(--text-muted, #64748b);
    transition: color 140ms ease;
}
.app-drawer-item:hover {
    background: #f1f5f9;
    color: var(--text-primary, #0f172a);
}
.app-drawer-item:hover svg { color: var(--brand, #0078d7); }
.app-drawer-item.is-active {
    background: var(--brand-soft, #e0f2fe);
    color: #002a80;
    font-weight: 800;
}
.app-drawer-item.is-active svg { color: #0078d7; }
.app-drawer-item.is-active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 24px;
    border-radius: 0 3px 3px 0;
    background: #0078d7;
}
/* Atalho admin em dourado */
.app-drawer-item-admin svg { color: var(--gold, #b45309); }
.app-drawer-item-admin.is-active {
    background: var(--gold-soft, #fffbeb);
    color: #92400e;
}
.app-drawer-item-admin.is-active svg { color: var(--gold-light, #f59e0b); }
.app-drawer-item-admin.is-active::before { background: var(--gold-light, #f59e0b); }

/* ---- Rodape ---- */
.app-drawer-foot {
    padding: 12px;
    border-top: 1px solid var(--border-soft, #edf2f7);
}
.app-drawer-logout {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 11px 12px;
    border-radius: 10px;
    color: var(--text-secondary, #334155);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    transition: background 140ms ease, color 140ms ease;
}
.app-drawer-logout svg { width: 22px; height: 22px; color: var(--text-muted, #64748b); }
.app-drawer-logout:hover {
    background: #fef2f2;
    color: #dc2626;
}
.app-drawer-logout:hover svg { color: #dc2626; }

/* Trava o scroll do body com a gaveta aberta */
body.app-drawer-lock { overflow: hidden; }

/* Respeita preferencia de menos animacao */
@media (prefers-reduced-motion: reduce) {
    .app-drawer,
    .app-drawer-scrim { transition: none; }
}
