/* =====================================================================
   base.css — Design System
   Paleta dourada/dark, sóbria, feita para credibilidade técnica-jurídica.
   ===================================================================== */

/* ---------- CSS Variables ---------- */
:root {
    /* Cores — fundo */
    --bg:         #0a0a0b;
    --bg-elev:    #131317;
    --bg-elev-2:  #1b1b20;
    --bg-elev-3:  #24242a;

    /* Cores — bordas */
    --border:     #26262d;
    --border-hi:  #35353d;

    /* Cores — texto */
    --text:        #e9e9ec;
    --text-dim:    #9b9ba2;
    --text-muted:  #66666e;

    /* Cores — marca (dourado) */
    --gold:        #c9a449;
    --gold-hi:     #e0b95e;
    --gold-lo:     #a8881e;
    --gold-soft:   rgba(201, 164, 73, 0.14);
    --gold-softer: rgba(201, 164, 73, 0.06);

    /* Cores — estado */
    --red:        #d94b3a;
    --red-soft:   rgba(217, 75, 58, 0.14);
    --green:      #51c878;
    --green-soft: rgba(81, 200, 120, 0.14);
    --amber:      #e8a33a;
    --amber-soft: rgba(232, 163, 58, 0.14);

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.6);

    /* Raio */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    /* Espaçamento */
    --sp-1:  4px;
    --sp-2:  8px;
    --sp-3:  12px;
    --sp-4:  16px;
    --sp-5:  24px;
    --sp-6:  32px;
    --sp-7:  48px;
    --sp-8:  72px;
    --sp-9:  96px;

    /* Tipografia */
    --font-sans:  system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-serif: Georgia, "Times New Roman", serif;
    --font-mono:  "SF Mono", Menlo, Consolas, "Courier New", monospace;

    /* Layout */
    --container:  1180px;
    --container-narrow: 760px;

    /* Transição */
    --t-fast:   120ms ease;
    --t-norm:   200ms ease;
    --t-slow:   320ms ease;
}

/* ---------- Reset minimalista ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

a {
    color: var(--gold);
    text-decoration: none;
    transition: color var(--t-fast);
}
a:hover { color: var(--gold-hi); text-decoration: underline; }

::selection { background: var(--gold); color: var(--bg); }

/* ---------- Tipografia ---------- */
h1, h2, h3, h4, h5, h6 {
    margin: 0 0 var(--sp-4);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
    letter-spacing: -0.015em;
}
h1 { font-size: clamp(32px, 4.5vw, 56px); font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: clamp(26px, 3vw, 38px); letter-spacing: -0.015em; }
h3 { font-size: clamp(20px, 2vw, 24px); font-weight: 600; }
h4 { font-size: 18px; font-weight: 600; }

p  { margin: 0 0 var(--sp-4); }
small { font-size: 13px; color: var(--text-dim); }

code, kbd {
    font-family: var(--font-mono);
    font-size: 0.92em;
    background: var(--bg-elev-2);
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid var(--border);
}

/* ---------- Layout utilities ---------- */
.container {
    max-width: var(--container);
    margin-inline: auto;
    padding: 0 var(--sp-5);
}
.container-narrow {
    max-width: var(--container-narrow);
    margin-inline: auto;
    padding: 0 var(--sp-5);
}
.section {
    padding: var(--sp-8) 0;
}
.section--tight { padding: var(--sp-6) 0; }

.grid       { display: grid; gap: var(--sp-5); }
.grid-2     { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3     { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4     { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

.flex       { display: flex; gap: var(--sp-4); }
.flex-wrap  { flex-wrap: wrap; }
.flex-center{ align-items: center; justify-content: center; }
.flex-between{ align-items: center; justify-content: space-between; }
.flex-col   { flex-direction: column; }

.text-dim   { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-gold  { color: var(--gold); }
.text-center{ text-align: center; }

/* ---------- Botões ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--sp-2);
    padding: 12px 22px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 15px;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: background var(--t-fast), border-color var(--t-fast),
                color var(--t-fast), transform var(--t-fast);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}
.btn:disabled,
.btn[aria-disabled="true"] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-primary {
    background: var(--gold);
    color: #1a1406;
    border-color: var(--gold);
}
.btn-primary:hover { background: var(--gold-hi); border-color: var(--gold-hi); }

.btn-secondary {
    background: transparent;
    color: var(--gold);
    border-color: var(--gold);
}
.btn-secondary:hover { background: var(--gold-soft); }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
    border-color: transparent;
}
.btn-ghost:hover { color: var(--text); background: var(--bg-elev-2); }

.btn-danger {
    background: var(--red);
    color: #fff;
    border-color: var(--red);
}
.btn-danger:hover { filter: brightness(1.1); }

.btn-lg  { padding: 16px 30px; font-size: 16px; }
.btn-sm  { padding: 8px 14px;  font-size: 13px; }
.btn-block { width: 100%; }

/* ---------- Formulários ---------- */
.field {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-bottom: var(--sp-4);
}
.field label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dim);
}
.field label .required { color: var(--red); }

.input, .select, .textarea {
    appearance: none;
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-elev);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    transition: border-color var(--t-fast), background var(--t-fast),
                box-shadow var(--t-fast);
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--border-hi); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--gold);
    background: var(--bg-elev-2);
    box-shadow: 0 0 0 3px var(--gold-softer);
}
.input::placeholder { color: var(--text-muted); }

.field-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--sp-1);
}
.field-error {
    font-size: 13px;
    color: var(--red);
    margin-top: var(--sp-1);
}
.field.has-error .input,
.field.has-error .select,
.field.has-error .textarea {
    border-color: var(--red);
}

/* Checkbox / radio */
.check {
    display: inline-flex;
    align-items: flex-start;
    gap: var(--sp-2);
    cursor: pointer;
    user-select: none;
    font-size: 14px;
    color: var(--text-dim);
}
.check input[type="checkbox"],
.check input[type="radio"] {
    appearance: none;
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    border: 1px solid var(--border-hi);
    border-radius: 4px;
    background: var(--bg-elev);
    cursor: pointer;
    transition: all var(--t-fast);
    display: grid;
    place-content: center;
}
.check input[type="radio"] { border-radius: 50%; }
.check input:checked {
    background: var(--gold);
    border-color: var(--gold);
}
.check input[type="checkbox"]:checked::after {
    content: '';
    width: 5px; height: 10px;
    border: 2px solid var(--bg);
    border-top: 0; border-left: 0;
    transform: rotate(45deg) translate(-1px, -1px);
}
.check input[type="radio"]:checked::after {
    content: '';
    width: 8px; height: 8px;
    background: var(--bg);
    border-radius: 50%;
}

/* Medidor de força de senha */
.pwd-meter {
    display: flex;
    gap: 3px;
    margin-top: 6px;
}
.pwd-meter__bar {
    flex: 1;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    transition: background var(--t-fast);
}
.pwd-meter__bar.on-weak   { background: var(--red); }
.pwd-meter__bar.on-fair   { background: var(--amber); }
.pwd-meter__bar.on-good   { background: #8bc34a; }
.pwd-meter__bar.on-strong { background: var(--green); }
.pwd-meter__label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ---------- Cards ---------- */
.card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--sp-5);
    transition: border-color var(--t-norm), transform var(--t-norm);
}
.card:hover { border-color: var(--border-hi); }
.card--hover:hover {
    transform: translateY(-2px);
    border-color: var(--gold);
}
.card h3 { margin-bottom: var(--sp-3); }
.card__icon {
    width: 44px; height: 44px;
    display: grid; place-content: center;
    background: var(--gold-soft);
    border-radius: var(--radius-sm);
    color: var(--gold);
    margin-bottom: var(--sp-4);
}
.card__icon svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Alert ---------- */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    margin-bottom: var(--sp-4);
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: var(--sp-2);
}
.alert-success { background: var(--green-soft);  border-color: var(--green); color: #a7e6b9; }
.alert-error   { background: var(--red-soft);    border-color: var(--red);   color: #f0a59d; }
.alert-warn    { background: var(--amber-soft);  border-color: var(--amber); color: #f0c482; }
.alert-info    { background: var(--gold-soft);   border-color: var(--gold);  color: var(--gold-hi); }

/* ---------- Badge ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    border-radius: 100px;
    background: var(--gold-soft);
    color: var(--gold-hi);
    border: 1px solid var(--gold);
}
.badge-muted {
    background: var(--bg-elev-2);
    color: var(--text-dim);
    border-color: var(--border);
}

/* ---------- Navbar ---------- */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 10, 11, 0.85);
    backdrop-filter: saturate(180%) blur(8px);
    border-bottom: 1px solid var(--border);
}
.nav__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 64px;
}
.nav__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.01em;
    text-decoration: none;
}
.nav__brand:hover { text-decoration: none; color: var(--text); }
.nav__brand-logo {
    width: 28px; height: 28px;
    display: grid; place-content: center;
    background: var(--gold);
    color: #0a0a0b;
    border-radius: 6px;
    font-weight: 800;
    font-size: 14px;
}
.nav__brand-img {
    max-height: 36px;
    width: auto;
    display: block;
    object-fit: contain;
}
.nav__links {
    display: flex;
    align-items: center;
    gap: var(--sp-5);
    list-style: none;
    margin: 0;
    padding: 0;
}
.nav__links a {
    color: var(--text-dim);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: color var(--t-fast);
}
.nav__links a:hover { color: var(--text); }

.nav__cta { display: flex; gap: var(--sp-3); align-items: center; }

@media (max-width: 820px) {
    .nav__links { display: none; }
}

/* ---------- Footer ---------- */
.footer {
    border-top: 1px solid var(--border);
    background: var(--bg-elev);
    padding: var(--sp-7) 0 var(--sp-5);
    margin-top: var(--sp-8);
}
.footer__grid {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr);
    gap: var(--sp-6);
}
@media (max-width: 820px) {
    .footer__grid { grid-template-columns: 1fr 1fr; }
}
.footer h5 {
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--sp-4);
}
.footer ul {
    list-style: none;
    padding: 0; margin: 0;
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}
.footer a {
    color: var(--text-dim);
    font-size: 14px;
    text-decoration: none;
}
.footer a:hover { color: var(--text); }
.footer__bottom {
    margin-top: var(--sp-6);
    padding-top: var(--sp-5);
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--sp-3);
}

/* ---------- Toast (via JS) ---------- */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    pointer-events: none;
}
.toast {
    padding: 14px 18px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border-hi);
    border-left: 3px solid var(--gold);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    font-size: 14px;
    color: var(--text);
    max-width: 360px;
    pointer-events: auto;
    transform: translateX(400px);
    opacity: 0;
    transition: all var(--t-slow);
}
.toast.visible { transform: translateX(0); opacity: 1; }
.toast.toast-success { border-left-color: var(--green); }
.toast.toast-error   { border-left-color: var(--red); }
.toast.toast-warn    { border-left-color: var(--amber); }

/* ---------- Utilities ---------- */
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}
.hidden { display: none !important; }

.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-5 { margin-top: var(--sp-5); }
.mt-6 { margin-top: var(--sp-6); }

.divider {
    height: 1px;
    background: var(--border);
    margin: var(--sp-5) 0;
    border: 0;
}

/* ---------- Motion reduction ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}

/* ============================================
   Scrollbar estilizada (Webkit + Firefox)
   Cor dourada sutil combinando com o tema dark
   ============================================ */

/* Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(212, 175, 55, 0.3) transparent;
}

/* Chrome, Edge, Safari, Opera */
*::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
*::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 5px;
}
*::-webkit-scrollbar-thumb {
    background: linear-gradient(
        180deg,
        rgba(212, 175, 55, 0.25) 0%,
        rgba(212, 175, 55, 0.4) 100%
    );
    border-radius: 5px;
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background 0.2s ease;
}
*::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(
        180deg,
        rgba(212, 175, 55, 0.5) 0%,
        rgba(212, 175, 55, 0.7) 100%
    );
    background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:active {
    background: var(--gold);
    background-clip: padding-box;
}
*::-webkit-scrollbar-corner {
    background: transparent;
}

/* Scrollbar ainda mais discreta dentro de containers específicos */
.sidebar::-webkit-scrollbar,
.admin-side-panel::-webkit-scrollbar,
.user-menu__dropdown::-webkit-scrollbar {
    width: 6px;
}

/* ============================================
   Modal de confirmação
   ============================================ */
.modal-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.2s ease;
}
.modal-confirm-backdrop.is-open { opacity: 1; }

.modal-confirm {
    background: var(--bg-elev-1);
    border: 1px solid var(--gold);
    border-radius: var(--radius-md);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(212, 175, 55, 0.2);
    max-width: 460px;
    width: 100%;
    padding: var(--sp-5);
    transform: scale(0.95) translateY(-8px);
    transition: transform 0.2s ease;
}
.modal-confirm-backdrop.is-open .modal-confirm {
    transform: scale(1) translateY(0);
}
.modal-confirm--perigoso {
    border-color: var(--red);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6),
                0 0 0 1px rgba(220, 38, 38, 0.2);
}

.modal-confirm__header {
    display: flex;
    align-items: center;
    gap: var(--sp-3);
    margin-bottom: var(--sp-3);
}
.modal-confirm__icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(212, 175, 55, 0.12);
    color: var(--gold);
}
.modal-confirm__icon svg {
    width: 22px;
    height: 22px;
}
.modal-confirm--perigoso .modal-confirm__icon {
    background: rgba(220, 38, 38, 0.12);
    color: var(--red);
}

.modal-confirm__titulo {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
    line-height: 1.3;
}
.modal-confirm__mensagem {
    color: var(--text-dim);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 var(--sp-4);
    white-space: pre-line;
}

.modal-confirm__acoes {
    display: flex;
    gap: var(--sp-2);
    justify-content: flex-end;
    padding-top: var(--sp-3);
    border-top: 1px solid var(--border);
}
.modal-confirm__acoes .btn { min-width: 100px; }

@media (max-width: 480px) {
    .modal-confirm { padding: var(--sp-4); }
    .modal-confirm__acoes { flex-direction: column-reverse; }
    .modal-confirm__acoes .btn { width: 100%; }
}
