/* ==========================================================
   Tema escuro — preto e vermelho
   Carregado depois do sb-admin-2.min.css (sobrescreve as cores)
   ========================================================== */

:root {
    --bg: #0a0a0b;
    --bg-2: #111113;
    --surface: #16161a;
    --surface-2: #1d1d22;
    --border: #26262d;
    --border-strong: #34343c;
    --text: #e7e7ea;
    --text-muted: #9a9aa3;
    --text-dim: #6b6b74;
    --red: #e11d2e;
    --red-hover: #ff2d3f;
    --red-dark: #9b0f1b;
    --red-soft: rgba(225, 29, 46, .12);
    --red-glow: rgba(225, 29, 46, .35);
    --radius: 12px;
    --font: 'Inter', 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ---------- Base ---------- */
html, body, #wrapper, #content-wrapper, #content {
    background: var(--bg) !important;
    color: var(--text);
    font-family: var(--font);
}
body { -webkit-font-smoothing: antialiased; }

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { color: #fff; font-weight: 700; letter-spacing: -.01em; }
p, label, .form-label, td, th, li, span, small, .small { color: inherit; }
a { color: var(--red); }
a:hover { color: var(--red-hover); text-decoration: none; }
hr { border-color: var(--border); }
center { color: var(--text); }

::selection { background: var(--red); color: #fff; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--red-dark); }

/* ---------- Utilitários do SB Admin ---------- */
.bg-white, .bg-light { background-color: var(--surface) !important; }
.bg-gradient-primary { background: var(--bg) !important; }
.text-gray-900, .text-gray-800, .text-dark { color: #fff !important; }
.text-gray-700, .text-gray-600 { color: var(--text-muted) !important; }
.text-gray-500, .text-gray-400, .text-gray-300, .text-muted { color: var(--text-dim) !important; }
.text-primary { color: var(--red) !important; }
.bg-primary { background-color: var(--red) !important; }
.border-left-primary { border-left: .25rem solid var(--red) !important; }
.shadow, .shadow-sm, .shadow-lg { box-shadow: 0 8px 30px rgba(0, 0, 0, .45) !important; }

/* ---------- Sidebar ---------- */
.sidebar {
    background: linear-gradient(180deg, #0f0f11 0%, #0a0a0b 100%) !important;
    border-right: 1px solid var(--border);
}
.sidebar .sidebar-brand {
    height: 5rem;
    color: #fff !important;
    letter-spacing: .08em;
}
.sidebar .sidebar-brand .sidebar-brand-text {
    font-weight: 800;
    text-transform: uppercase;
    font-size: 1rem;
    background: linear-gradient(90deg, #fff 0%, #fff 40%, var(--red) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.sidebar .sidebar-brand::after {
    content: '';
    position: absolute;
    bottom: 0; left: 1rem; right: 1rem;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--red), transparent);
}
.sidebar .sidebar-brand { position: relative; }
.sidebar .sidebar-brand .brand-full { width: 170px; height: auto; display: block; }
.sidebar .sidebar-brand .brand-icon { width: 40px; height: 40px; display: none; }
.sidebar.toggled .sidebar-brand .brand-full { display: none; }
.sidebar.toggled .sidebar-brand .brand-icon { display: block; }
@media (max-width: 767.98px) {
    .sidebar .sidebar-brand .brand-full { display: none; }
    .sidebar .sidebar-brand .brand-icon { display: block; }
}
.sidebar hr.sidebar-divider { border-top: 1px solid var(--border) !important; margin: 0 1rem 1rem; }
.sidebar hr.sidebar-divider.my-0 { margin: 0 1rem .75rem !important; border: 0 !important; }

.sidebar .nav-item { padding: 0 .75rem; }
.sidebar .nav-item .nav-link {
    color: var(--text-muted) !important;
    border-radius: 10px;
    padding: .8rem 1rem !important;
    margin-bottom: .2rem;
    font-weight: 500;
    transition: background .15s ease, color .15s ease;
    position: relative;
    width: auto !important;
}
.sidebar .nav-item .nav-link i { color: var(--text-dim) !important; margin-right: .6rem; width: 1.1rem; text-align: center; transition: color .15s ease; }
.sidebar .nav-item .nav-link:hover {
    background: var(--surface-2);
    color: #fff !important;
}
.sidebar .nav-item .nav-link:hover i { color: var(--red) !important; }
.sidebar .nav-item.active .nav-link {
    background: var(--red-soft);
    color: #fff !important;
    font-weight: 600;
}
.sidebar .nav-item.active .nav-link i { color: var(--red) !important; }
.sidebar .nav-item.active .nav-link::before {
    content: '';
    position: absolute;
    left: -0.75rem; top: 20%; bottom: 20%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--red);
    box-shadow: 0 0 12px var(--red-glow);
}
.sidebar #sidebarToggle { background: var(--surface-2) !important; }
.sidebar #sidebarToggle::after { color: var(--text-muted) !important; }

/* Sidebar recolhida (sb-admin .toggled) */
.sidebar.toggled .nav-item { padding: 0 .5rem; }
.sidebar.toggled .nav-item .nav-link { text-align: center; padding: .75rem 0 !important; }
.sidebar.toggled .nav-item .nav-link i { margin-right: 0; }

/* ---------- Topbar ---------- */
.topbar {
    background: rgba(10, 10, 11, .85) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
    box-shadow: none !important;
    height: 4.375rem;
}
.topbar .topbar-divider { border-right: 1px solid var(--border) !important; }
.topbar .nav-item .nav-link { color: var(--text-muted) !important; }
.topbar .img-profile {
    border: 2px solid var(--red);
    padding: 2px;
    background: var(--surface);
}
#sidebarToggleTop { color: var(--text-muted) !important; background: transparent !important; }

/* Dropdown */
.dropdown-menu {
    background: var(--surface-2) !important;
    border: 1px solid var(--border-strong) !important;
    border-radius: 10px;
    padding: .4rem;
}
.dropdown-item { color: var(--text) !important; border-radius: 7px; padding: .55rem .9rem; }
.dropdown-item:hover, .dropdown-item:focus { background: var(--red-soft) !important; color: #fff !important; }
.dropdown-item:hover i { color: var(--red) !important; }
.dropdown-divider { border-top-color: var(--border) !important; }

/* ---------- Cards ---------- */
.card {
    background: var(--surface) !important;
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
    color: var(--text);
    overflow: hidden;
}
.card-header {
    background: var(--bg-2) !important;
    border-bottom: 1px solid var(--border) !important;
    position: relative;
}
.card-header::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--red);
}
.card-header h6, .card-header .text-primary {
    color: #fff !important;
    text-transform: uppercase;
    font-size: .78rem;
    letter-spacing: .08em;
}
.card-body { color: var(--text); }
.card-footer { background: var(--bg-2) !important; border-top: 1px solid var(--border) !important; }

/* Ilustrações undraw ficam com o roxo original — tingimos para combinar */
.card-body img[src*="undraw"] { filter: hue-rotate(110deg) saturate(1.4) brightness(.95); opacity: .9; }

/* Cards de estatística do dashboard */
.stat-card { text-decoration: none !important; transition: border-color .15s ease, transform .15s ease; }
.stat-card:hover { border-color: var(--red) !important; transform: translateY(-2px); }
.stat-card .stat-icon {
    width: 46px; height: 46px; flex: 0 0 46px;
    border-radius: 12px;
    background: var(--red-soft);
    color: var(--red);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    margin-right: 1rem;
}
.stat-card .stat-label { color: var(--text-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; }
.stat-card .stat-value { color: #fff; font-size: 1.6rem; font-weight: 800; line-height: 1.2; }

/* Página Postar: abas e prévia */
.post-tabs { display: inline-flex; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 4px; gap: 4px; }
.post-tab { background: transparent; border: 0; color: var(--text-muted); font-weight: 600; padding: .6rem 1.4rem; border-radius: 9px; transition: all .15s ease; }
.post-tab:hover { color: #fff; background: var(--surface-2); }
.post-tab.active { background: var(--red); color: #fff; box-shadow: 0 4px 16px var(--red-glow); }
.post-tab:focus { outline: none; }
#previa .previa-poster { width: 100%; max-width: 220px; display: block; margin: 0 auto 1rem; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
#previa .previa-titulo { color: #fff; font-weight: 800; font-size: 1.15rem; text-align: center; }
#previa .previa-meta { color: var(--red); font-size: .8rem; font-weight: 600; text-align: center; margin: .25rem 0 .75rem; text-transform: uppercase; letter-spacing: .05em; }
#previa .previa-sinopse { color: var(--text-muted); font-size: .85rem; margin: 0; }

/* SweetAlert no tema */
.swal2-popup { background: var(--surface) !important; border: 1px solid var(--border-strong) !important; border-radius: 14px !important; }
.swal2-title, .swal2-html-container { color: var(--text) !important; }

/* ---------- Botões ---------- */
.btn { border-radius: 9px; font-weight: 600; letter-spacing: .01em; transition: all .15s ease; }
.btn-primary, .btn-primary:not(:disabled):not(.disabled):active {
    background: var(--red) !important;
    border-color: var(--red) !important;
    color: #fff !important;
    box-shadow: 0 4px 16px var(--red-glow) !important;
}
.btn-primary:hover, .btn-primary:focus {
    background: var(--red-hover) !important;
    border-color: var(--red-hover) !important;
    box-shadow: 0 6px 22px var(--red-glow) !important;
    transform: translateY(-1px);
}
.btn-light {
    background: var(--surface-2) !important;
    border-color: var(--border-strong) !important;
    color: var(--text) !important;
}
.btn-light:hover { background: var(--border-strong) !important; color: #fff !important; }
.btn-dark, .btn-secondary {
    background: #000 !important;
    border-color: var(--border-strong) !important;
    color: #fff !important;
}
.btn-dark:hover, .btn-secondary:hover { border-color: var(--red) !important; color: #fff !important; }
.btn-danger { background: var(--red-dark) !important; border-color: var(--red-dark) !important; }
.btn-danger:hover { background: var(--red) !important; border-color: var(--red) !important; }
.btn-success { background: #15803d !important; border-color: #15803d !important; }
.btn-warning { background: #b45309 !important; border-color: #b45309 !important; color: #fff !important; }
.btn-info { background: #27272f !important; border-color: var(--border-strong) !important; color: #fff !important; }
.btn-outline-primary { color: var(--red) !important; border-color: var(--red) !important; }
.btn-outline-primary:hover { background: var(--red) !important; color: #fff !important; }
.btn:focus, .btn.focus { box-shadow: 0 0 0 .2rem var(--red-soft) !important; }

/* ---------- Formulários ---------- */
.form-control, .custom-select, select, textarea, input[type="text"], input[type="email"],
input[type="password"], input[type="number"], input[type="url"], input[type="date"],
input[type="time"], input[type="datetime-local"], input[type="search"] {
    background-color: var(--bg-2) !important;
    border: 1px solid var(--border-strong) !important;
    color: var(--text) !important;
    border-radius: 9px !important;
}
.form-control::placeholder { color: var(--text-dim) !important; }
.form-control:focus, .custom-select:focus, select:focus, textarea:focus, input:focus {
    background-color: var(--bg-2) !important;
    border-color: var(--red) !important;
    box-shadow: 0 0 0 .2rem var(--red-soft) !important;
    color: #fff !important;
    outline: none;
}
.form-control:disabled, .form-control[readonly] { background-color: var(--surface-2) !important; color: var(--text-dim) !important; }
select option { background: var(--surface-2); color: var(--text); }
input[type="date"]::-webkit-calendar-picker-indicator,
input[type="time"]::-webkit-calendar-picker-indicator,
input[type="datetime-local"]::-webkit-calendar-picker-indicator { filter: invert(1) opacity(.6); }

form.user .form-control-user { border-radius: 10px !important; padding: 1.4rem 1.1rem; font-size: .9rem; }
form.user .btn-user { border-radius: 10px; padding: .85rem 1rem; font-size: .9rem; text-transform: uppercase; letter-spacing: .08em; }

.custom-control-label { color: var(--text-muted); }
.custom-control-label::before { background: var(--bg-2) !important; border-color: var(--border-strong) !important; }
.custom-control-input:checked ~ .custom-control-label::before { background: var(--red) !important; border-color: var(--red) !important; }
.custom-control-input:focus ~ .custom-control-label::before { box-shadow: 0 0 0 .2rem var(--red-soft) !important; }

.input-group-text { background: var(--surface-2) !important; border-color: var(--border-strong) !important; color: var(--text-muted) !important; }

/* ---------- Tabelas / DataTables ---------- */
.table { color: var(--text) !important; }
.table thead th {
    background: var(--bg-2);
    color: var(--text-muted) !important;
    text-transform: uppercase;
    font-size: .72rem;
    letter-spacing: .08em;
    border-bottom: 1px solid var(--border-strong) !important;
    border-top: 0 !important;
}
.table td, .table th { border-color: var(--border) !important; vertical-align: middle; }
.table-bordered, .table-bordered td, .table-bordered th { border-color: var(--border) !important; }
.table-striped tbody tr:nth-of-type(odd) { background: rgba(255, 255, 255, .02); }
.table-hover tbody tr:hover, .table tbody tr:hover { background: var(--red-soft) !important; color: #fff; }

.dataTables_wrapper, .dataTables_wrapper label, .dataTables_info { color: var(--text-muted) !important; }
.dataTables_wrapper .dataTables_filter input, .dataTables_wrapper .dataTables_length select {
    background: var(--bg-2) !important; border: 1px solid var(--border-strong) !important; color: var(--text) !important;
}
.page-link { background: var(--surface-2) !important; border-color: var(--border) !important; color: var(--text-muted) !important; }
.page-link:hover { background: var(--border-strong) !important; color: #fff !important; }
.page-item.active .page-link { background: var(--red) !important; border-color: var(--red) !important; color: #fff !important; }
.page-item.disabled .page-link { background: var(--bg-2) !important; color: var(--text-dim) !important; }

/* ---------- Alertas / badges / modais ---------- */
.alert { border-radius: 10px; border: 1px solid var(--border-strong); }
.alert-danger { background: rgba(225, 29, 46, .12) !important; border-color: rgba(225, 29, 46, .4) !important; color: #ffb3ba !important; }
.alert-success { background: rgba(21, 128, 61, .14) !important; border-color: rgba(21, 128, 61, .45) !important; color: #a7f3c0 !important; }
.alert-warning { background: rgba(180, 83, 9, .14) !important; border-color: rgba(180, 83, 9, .45) !important; color: #fcd9a8 !important; }
.alert-info, .alert-primary { background: var(--surface-2) !important; border-color: var(--border-strong) !important; color: var(--text) !important; }

.badge-primary { background: var(--red) !important; }
.badge-secondary, .badge-light { background: var(--surface-2) !important; color: var(--text) !important; }

.modal-content { background: var(--surface) !important; border: 1px solid var(--border-strong) !important; border-radius: var(--radius) !important; color: var(--text); }
.modal-header, .modal-footer { border-color: var(--border) !important; }
.close { color: var(--text) !important; text-shadow: none !important; opacity: .7; }
.close:hover { color: var(--red) !important; opacity: 1; }

.list-group-item { background: var(--surface) !important; border-color: var(--border) !important; color: var(--text) !important; }
.progress { background: var(--surface-2) !important; }
.progress-bar { background: var(--red) !important; }

/* ---------- Rodapé / extras ---------- */
footer.sticky-footer { background: var(--bg) !important; border-top: 1px solid var(--border); }
footer.sticky-footer .copyright span { color: var(--text-dim) !important; font-size: .78rem; }
.scroll-to-top { background: var(--red) !important; border-radius: 10px !important; box-shadow: 0 4px 16px var(--red-glow); }
.scroll-to-top:hover { background: var(--red-hover) !important; }

/* ---------- Tela de login ---------- */
body.bg-gradient-primary {
    min-height: 100vh;
    display: flex;
    align-items: center;
    background:
        radial-gradient(ellipse 60% 50% at 50% 0%, rgba(225, 29, 46, .22), transparent 70%),
        radial-gradient(ellipse 40% 40% at 100% 100%, rgba(225, 29, 46, .10), transparent 70%),
        var(--bg) !important;
}
body.bg-gradient-primary > .container { width: 100%; }
body.bg-gradient-primary .card {
    background: rgba(22, 22, 26, .85) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-strong) !important;
    border-top: 2px solid var(--red) !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, .6), 0 0 60px rgba(225, 29, 46, .08) !important;
    border-radius: 16px !important;
}
body.bg-gradient-primary .card .p-5 { padding: 2.75rem !important; }
body.bg-gradient-primary .card h1 img { max-width: 220px; filter: drop-shadow(0 6px 18px rgba(225, 29, 46, .25)); }
body.bg-gradient-primary .card h1.h4 { color: #fff !important; font-weight: 700; }

@media (max-width: 576px) {
    body.bg-gradient-primary .card .p-5 { padding: 1.75rem !important; }
}
