/* ============================================================
   Design system do painel administrativo — Sistema Hotspot
   Componentes em CSS puro (sem build step, compatível com
   hospedagem compartilhada). Tailwind (via CDN) é usado só
   para utilitários pontuais de layout (grid/flex/spacing).
   ============================================================ */

:root {
    --color-primary: #4f46e5;
    --color-primary-dark: #4338ca;
    --color-primary-soft: #eef2ff;
    --color-bg: #f7f8fb;
    --color-surface: #ffffff;
    --color-border: #e5e7eb;
    --color-text: #111827;
    --color-text-muted: #6b7280;
    --color-text-faint: #9ca3af;
    --color-success: #059669;
    --color-success-soft: #ecfdf5;
    --color-warning: #d97706;
    --color-warning-soft: #fffbeb;
    --color-danger: #dc2626;
    --color-danger-soft: #fef2f2;
    --color-neutral-soft: #f3f4f6;
    --sidebar-width: 248px;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-card: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .06);
    --shadow-pop: 0 4px 12px rgba(16, 24, 40, .08), 0 2px 4px rgba(16, 24, 40, .06);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* ===== Shell / layout ===== */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width); flex-shrink: 0; background: #111827;
    color: #d1d5db; display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0;
    z-index: 40; transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: #fff;
    font-weight: 700; font-size: 15px; letter-spacing: -.01em; border-bottom: 1px solid #ffffff14;
}
.sidebar-brand .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--color-primary); box-shadow: 0 0 0 3px #4f46e533; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 16px 12px; }
.sidebar-section-label {
    font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
    color: #6b7280; padding: 14px 12px 6px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--radius-sm);
    font-size: 13.5px; font-weight: 500; color: #cbd5e1; text-decoration: none; margin-bottom: 2px;
    transition: background .15s ease, color .15s ease;
}
.sidebar-link svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.sidebar-link:hover { background: #ffffff0d; color: #fff; }
.sidebar-link.active { background: var(--color-primary); color: #fff; }
.sidebar-link.active svg { opacity: 1; }
.sidebar-footer { padding: 14px 20px; border-top: 1px solid #ffffff14; }
.sidebar-user { display: flex; align-items: center; gap: 10px; }
.sidebar-user-avatar {
    width: 30px; height: 30px; border-radius: 50%; background: var(--color-primary);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; color: #e5e7eb; font-weight: 600; line-height: 1.2; }
.sidebar-logout { font-size: 11.5px; color: #94a3b8; text-decoration: none; }
.sidebar-logout:hover { color: #fca5a5; }

.main { flex: 1; margin-left: var(--sidebar-width); min-width: 0; }

.topbar {
    position: sticky; top: 0; z-index: 30; background: var(--color-surface); border-bottom: 1px solid var(--color-border);
    padding: 14px 28px; display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.topbar-title { font-size: 15px; font-weight: 700; color: var(--color-text); }
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; color: var(--color-text); }

.content { padding: 28px; max-width: 1180px; }

.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .sidebar-toggle { display: inline-flex; }
    .sidebar-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
    .content { padding: 20px; }
}

/* ===== Page header ===== */
.page-header { margin-bottom: 24px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; color: var(--color-text); margin: 0; }
.page-subtitle { font-size: 13.5px; color: var(--color-text-muted); margin: 4px 0 0; }

/* ===== Card ===== */
.card {
    background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius);
    box-shadow: var(--shadow-card); padding: 22px;
}
.card + .card { margin-top: 20px; }
.card-title { font-size: 14.5px; font-weight: 700; color: var(--color-text); margin: 0 0 4px; }
.card-subtitle { font-size: 12.5px; color: var(--color-text-muted); margin: 0 0 16px; }

/* ===== Buttons ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600;
    border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: all .15s ease; line-height: 1.2;
}
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--color-primary); color: #fff; box-shadow: 0 1px 2px rgba(79,70,229,.3); }
.btn-primary:hover { background: var(--color-primary-dark); }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-neutral-soft); }
.btn-danger-ghost { background: transparent; color: var(--color-danger); padding: 4px 8px; font-size: 12.5px; }
.btn-danger-ghost:hover { background: var(--color-danger-soft); }
.btn-ghost { background: transparent; color: var(--color-text-muted); padding: 4px 8px; font-size: 12.5px; }
.btn-ghost:hover { background: var(--color-neutral-soft); color: var(--color-text); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn:disabled { opacity: .55; cursor: default; }

/* ===== Badges ===== */
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; text-transform: capitalize; white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-success { background: var(--color-success-soft); color: var(--color-success); }
.badge-warning { background: var(--color-warning-soft); color: var(--color-warning); }
.badge-danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge-neutral { background: var(--color-neutral-soft); color: var(--color-text-muted); }
.badge-primary { background: var(--color-primary-soft); color: var(--color-primary); }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table thead th {
    text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
    color: var(--color-text-faint); padding: 0 14px 10px; border-bottom: 1px solid var(--color-border);
}
.data-table tbody td { padding: 13px 14px; border-bottom: 1px solid #f1f2f5; color: var(--color-text); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr { transition: background .1s ease; }
.data-table tbody tr:hover { background: #fafafa; }
.data-table .mono { font-family: 'SF Mono', ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.data-table .muted { color: var(--color-text-muted); }

/* ===== Empty state ===== */
.empty-state { text-align: center; padding: 48px 20px; color: var(--color-text-muted); }
.empty-state-icon { width: 40px; height: 40px; margin: 0 auto 12px; color: var(--color-text-faint); }
.empty-state-text { font-size: 13.5px; }

/* ===== Forms ===== */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--color-text); margin-bottom: 6px; }
.form-hint { font-size: 11.5px; color: var(--color-text-faint); margin-top: 5px; }
.form-input, select.form-input, textarea.form-input {
    width: 100%; padding: 9px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border);
    background: var(--color-surface); color: var(--color-text); font-size: 13.5px; font-family: inherit;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.form-input:focus { outline: none; border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-soft); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text); }
.form-check input { width: 16px; height: 16px; accent-color: var(--color-primary); }

/* ===== Alerts ===== */
.alert { padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-danger { background: var(--color-danger-soft); color: #991b1b; border-color: #fecaca; }
.alert-info { background: var(--color-primary-soft); color: var(--color-primary-dark); border-color: #c7d2fe; }

/* ===== Stat grid ===== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.stat-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 16px 18px; }
.stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--color-text-faint); margin-bottom: 6px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--color-text); letter-spacing: -.02em; }

/* ===== Links ===== */
a.link { color: var(--color-primary); text-decoration: none; font-weight: 600; }
a.link:hover { text-decoration: underline; }

/* ===== Login page ===== */
.auth-shell {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background:
        radial-gradient(circle at 15% 0%, #4f46e522, transparent 50%),
        radial-gradient(circle at 100% 100%, #4f46e51a, transparent 45%),
        var(--color-bg);
    padding: 20px;
}
.auth-card {
    width: 100%; max-width: 380px; background: var(--color-surface); border: 1px solid var(--color-border);
    border-radius: 18px; padding: 36px 32px; box-shadow: var(--shadow-pop);
}
.auth-logo {
    width: 44px; height: 44px; border-radius: 12px; background: var(--color-primary); color: #fff;
    display: flex; align-items: center; justify-content: center; margin: 0 auto 18px; font-weight: 800; font-size: 17px;
}

/* ===== Modo escuro ===== */
:root[data-theme="dark"] {
    --color-bg: #0b0e14;
    --color-surface: #12161f;
    --color-border: #232937;
    --color-text: #e5e7eb;
    --color-text-muted: #9aa3b5;
    --color-text-faint: #6b7385;
    --color-neutral-soft: #1a1f2b;
    --color-success-soft: #052e21;
    --color-warning-soft: #2e2205;
    --color-danger-soft: #2e0a0a;
    --color-primary-soft: #1a1c3a;
}
:root[data-theme="dark"] .sidebar { background: #05070c; }
:root[data-theme="dark"] .data-table tbody tr:hover { background: #171b26; }
:root[data-theme="dark"] .auth-shell { background: radial-gradient(circle at 15% 0%, #4f46e522, transparent 50%), var(--color-bg); }

.theme-toggle {
    background: none; border: 1px solid var(--color-border); color: var(--color-text-muted); cursor: pointer;
    border-radius: var(--radius-sm); padding: 6px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px;
}
.theme-toggle:hover { color: var(--color-text); }

/* ===== Toasts ===== */
#toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
    background: var(--color-text); color: var(--color-surface); padding: 11px 18px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 500; box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(8px); transition: all .25s ease;
    max-width: 320px;
}
.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: var(--color-success); color: #fff; }
.toast-error { background: var(--color-danger); color: #fff; }

/* ===== Modal de confirmação ===== */
.confirm-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 150; display: none;
    align-items: center; justify-content: center; backdrop-filter: blur(2px);
}
.confirm-overlay.open { display: flex; }
.confirm-box {
    background: var(--color-surface); border-radius: var(--radius); padding: 22px; width: 100%; max-width: 340px;
    box-shadow: var(--shadow-pop); border: 1px solid var(--color-border);
}
.confirm-text { font-size: 13.5px; color: var(--color-text); margin-bottom: 18px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ===== Chart wrapper ===== */
.chart-box { position: relative; height: 240px; }

/* ===== Rodapé de autoria ===== */
.app-footer { text-align: center; font-size: 11px; color: var(--color-text-faint); margin-top: 32px; padding: 16px 0; }
.app-footer-auth { position: fixed; bottom: 0; left: 0; right: 0; }

/* ===== Editor de slide (crop + texto no formato story) ===== */
.editor-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.7); z-index: 300; display: none;
    align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(2px);
}
.editor-overlay.open { display: flex; }
.editor-box {
    background: var(--color-surface); border-radius: var(--radius); border: 1px solid var(--color-border);
    box-shadow: var(--shadow-pop); width: 100%; max-width: 420px; padding: 20px; max-height: 92vh; overflow-y: auto;
}
.editor-box h3 { margin: 0 0 4px; font-size: 15px; }
.editor-box .editor-hint { font-size: 12px; color: var(--color-text-muted); margin: 0 0 14px; }
.editor-crop-wrap { max-height: 55vh; overflow: hidden; background: #000; border-radius: var(--radius-sm); }
.editor-crop-wrap img { display: block; max-width: 100%; }
.editor-stage {
    position: relative; width: 216px; aspect-ratio: 9/16; margin: 0 auto; background: #000;
    border-radius: var(--radius-sm); overflow: hidden; user-select: none;
}
.editor-stage img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
.editor-text-layer {
    position: absolute; left: 0; top: 0; cursor: grab; padding: 2px 6px; font-weight: 700;
    text-shadow: 0 2px 6px rgba(0,0,0,.6); white-space: nowrap; touch-action: none;
}
.editor-text-layer.dragging { cursor: grabbing; outline: 1px dashed #fff; }
.editor-toolbar { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.editor-toolbar label { font-size: 11.5px; color: var(--color-text-muted); display: flex; align-items: center; gap: 5px; }
.editor-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-end; }
