@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=DM+Serif+Display:ital@0;1&display=swap');

/* RESET GLOBAL */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: 'Outfit', 'Segoe UI', sans-serif;
    background: #07090f;
    background-attachment: fixed;
    color: #e2e6f0;
}

/* Mantém os controles nativos (selects, calendários e barras de rolagem)
   coerentes com o tema ativo. */
html { color-scheme: dark; }
html.light-theme-early,
body.light-theme { color-scheme: light; }

/* SCROLLBAR CUSTOMIZADO */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(200, 168, 75, 0.25);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(200, 168, 75, 0.45);
}

/* TOPBAR — estilo cinematográfico (transparente → blur ao scrollar) */
.topbar {
    height: 68px;
    padding: 0 36px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(to bottom, rgba(0,0,0,0.85), transparent);
    border-bottom: none;
    position: sticky;
    top: 0;
    z-index: 100;
    transition: background 0.3s, backdrop-filter 0.3s, border-color 0.3s;
}
.topbar.scrolled {
    background: rgba(8, 11, 18, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.topbar-back {
    color: rgba(226, 230, 240, 0.6);
    font-size: 1rem;
    text-decoration: none;
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    transition: all 0.2s;
}
.topbar-back:hover { color: #e2e6f0; background: rgba(255,255,255,0.06); }
.topbar-user {
    color: rgba(226, 230, 240, 0.6);
    font-size: 1.25rem;
    text-decoration: none;
    transition: color 0.2s;
}
.topbar-user:hover { color: #e2e6f0; }

.logo-header {
    display: flex;
    align-items: center;
    text-decoration: none;
    transition: opacity 0.2s;
    flex-shrink: 0;
}

.logo-header:hover {
    opacity: 0.7;
}

.logo-header img {
    height: 40px;
    display: block;
}

.logout {
    background: transparent;
    color: rgba(226, 230, 240, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 9px 18px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Outfit', sans-serif;
    font-weight: 500;
    font-size: 0.87rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logout:hover {
    background: rgba(255, 255, 255, 0.06);
    color: #e2e6f0;
    border-color: rgba(255, 255, 255, 0.18);
}

/* LINKS */
a {
    color: var(--link-color, #c8a84b);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--link-hover-color, #e8c96a);
}

/* A paleta e os controles dos dois temas ficam em theme.css. */

/* =========================================================
   MOBILE BASICS — proteções universais
   ========================================================= */

/* Previne scroll horizontal acidental */
html, body {
    /* Corta apenas o excesso horizontal sem criar um segundo scroll vertical. */
    overflow-x: clip;
    max-width: 100vw;
}

/* iOS: inputs com fonte < 16px causam zoom automático no foco */
input, select, textarea {
    font-size: max(16px, 1rem);
}

/* Touch targets minimos (Apple HIG: 44x44; Material: 48x48) */
@media (max-width: 768px) {
    button, .btn, a.btn, [role="button"] {
        min-height: 44px;
    }

    /* Topbar default mais compacta em mobile (paginas que nao sobrescrevem) */
    .topbar {
        padding: 0 16px;
        height: 56px;
    }

    /* Imagens responsivas por padrao */
    img {
        max-width: 100%;
        height: auto;
    }

    /* Modais/dialogs nao devem estourar viewport */
    .modal, .dialog, [role="dialog"] {
        max-width: 95vw;
        max-height: 90vh;
        overflow-y: auto;
    }

    /* Tabelas com scroll horizontal proprio em vez de quebrar layout */
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* Reduce motion — respeita preferencia do sistema */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
