/* ============================================================
   REDE DRAGON — SERVIDOR CENTRAL DE ATUALIZAÇÕES
   Arquivo: /central-updates/admin/style.css
   Tema: Dark moderno — grafite/slate com acento "brasa" (ember)
   Totalmente responsivo (mobile-first breakpoints)
   ============================================================ */

:root {
    --bg:             #0b0d12;
    --bg-elevated:    #12151d;
    --bg-panel:       #171b25;
    --bg-panel-hover: #1d222f;
    --bg-input:       #0f1219;
    --border:         #262c3a;
    --border-soft:    #1b202b;

    --text:           #edeff4;
    --text-muted:     #939bb0;
    --text-faint:     #5b6478;

    --accent:         #ff6a3d;
    --accent-2:       #ff3d5a;
    --accent-soft:    rgba(255, 106, 61, 0.14);
    --accent-grad:    linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);

    --ok:             #2dd4a7;
    --ok-soft:        rgba(45, 212, 167, 0.14);
    --warn:           #ffb84d;
    --warn-soft:      rgba(255, 184, 77, 0.14);
    --danger:         #ff5470;
    --danger-soft:    rgba(255, 84, 112, 0.14);

    --shadow-sm:  0 1px 2px rgba(0,0,0,.3);
    --shadow-md:  0 8px 24px rgba(0,0,0,.35);
    --shadow-lg:  0 20px 60px rgba(0,0,0,.45);

    --radius-sm: 8px;
    --radius:    12px;
    --radius-lg: 16px;

    --font-display: 'JetBrains Mono', 'SFMono-Regular', Consolas, monospace;
    --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

    --sidebar-w: 240px;
    --topbar-h:  64px;

    --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
}

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
::selection { background: var(--accent-soft); color: var(--accent); }

/* Scrollbar (Webkit + Firefox) */
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; border: 2px solid var(--bg); }
*::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

img, svg { max-width: 100%; }

/* ============================================================
   LOGIN (tela sem sidebar)
   ============================================================ */

.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(700px circle at 15% 15%, rgba(255,106,61,0.10), transparent 60%),
        radial-gradient(600px circle at 90% 85%, rgba(255,61,90,0.08), transparent 55%),
        var(--bg);
    padding: 24px;
}
.login-box {
    width: 100%;
    max-width: 380px;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    padding: clamp(28px, 6vw, 40px) clamp(22px, 6vw, 34px);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: rise .35s var(--ease);
}
@keyframes rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
.login-mark {
    display: flex;
    align-items: center;
    gap: 10px;
    justify-content: center;
    margin-bottom: 10px;
}
.login-mark svg { width: 30px; height: 30px; flex-shrink: 0; color: var(--accent); }
.login-mark-text { font-family: var(--font-display); font-weight: 700; letter-spacing: .5px; font-size: 16px; }
.login-box .subtitulo { text-align: center; color: var(--text-muted); font-size: 12.5px; margin: 0 0 26px; letter-spacing: .4px; text-transform: uppercase; }
.marca-rodape { text-align: center; color: var(--text-faint); font-size: 12px; margin-top: 22px; }

/* ============================================================
   APP SHELL — sidebar + topbar + conteúdo
   ============================================================ */

.app-shell { display: flex; min-height: 100vh; min-height: 100dvh; }

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--bg-elevated);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; bottom: 0; left: 0;
    z-index: 20;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 18px;
    border-bottom: 1px solid var(--border-soft);
}
.sidebar-brand svg { width: 26px; height: 26px; flex-shrink: 0; color: var(--accent); }
.sidebar-brand-text { line-height: 1.15; }
.sidebar-brand-text strong { font-family: var(--font-display); font-size: 14px; letter-spacing: .3px; display: block; }
.sidebar-brand-text span { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .8px; }

.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-section-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .8px; color: var(--text-faint); padding: 14px 10px 6px; }
.sidebar-section-label:first-child { padding-top: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: .8; transition: opacity .15s var(--ease); }
.nav-item:hover { background: var(--bg-panel-hover); color: var(--text); }
.nav-item:hover svg { opacity: 1; }
.nav-item.ativo { background: var(--accent-soft); color: var(--accent); }
.nav-item.ativo svg { opacity: 1; }

.sidebar-footer { padding: 14px 20px 18px; border-top: 1px solid var(--border-soft); }
.sidebar-footer .nav-item { color: var(--text-faint); padding-left: 0; }
.sidebar-footer .nav-item:hover { color: var(--danger); background: none; }

.app-main { margin-left: var(--sidebar-w); flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(11,13,18,0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.topbar h1 { font-size: 16px; font-weight: 600; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar-user { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--text-muted); }
.avatar-dot {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent-grad);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; font-size: 12px; color: #fff;
    flex-shrink: 0;
}

.app-content { padding: 28px; max-width: 1180px; width: 100%; margin: 0 auto; }

/* ============================================================
   CARDS INDICATIVOS (dashboard)
   ============================================================ */

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: border-color .15s var(--ease), transform .15s var(--ease);
}
.stat-card:hover { border-color: var(--text-faint); transform: translateY(-1px); }
.stat-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--accent-grad);
    opacity: 0;
    transition: opacity .15s var(--ease);
}
.stat-card.destaque::before { opacity: 1; }
.stat-icon {
    width: 34px; height: 34px; border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    background: var(--accent-soft); color: var(--accent);
    margin-bottom: 14px;
}
.stat-icon svg { width: 18px; height: 18px; }
.stat-icon.ok { background: var(--ok-soft); color: var(--ok); }
.stat-icon.warn { background: var(--warn-soft); color: var(--warn); }
.stat-value { font-family: var(--font-display); font-size: 26px; font-weight: 700; line-height: 1; margin-bottom: 6px; word-break: break-word; }
.stat-label { font-size: 12.5px; color: var(--text-muted); }

.section-title {
    font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .5px;
    color: var(--text-muted); margin: 30px 0 12px;
}
.section-title:first-child { margin-top: 0; }

/* ============================================================
   PAINÉIS / FORMULÁRIOS
   ============================================================ */

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px 24px;
}
.form-box { max-width: 480px; }

label { display: block; margin: 14px 0 6px; font-size: 13px; font-weight: 600; color: var(--text-muted); }
label:first-child { margin-top: 0; }

input[type=text], input[type=password], input[type=file], textarea, select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 13.5px;
    font-family: var(--font-body);
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.btn-block { width: 100%; justify-content: center; }

/* Autofill do navegador não deve quebrar o tema escuro */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--text);
    -webkit-box-shadow: 0 0 0 1000px var(--bg-input) inset;
    transition: background-color 9999s ease-in-out 0s;
}
::placeholder { color: var(--text-faint); opacity: 1; }

input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 96px; }

input[type=file] { padding: 8px 12px; cursor: pointer; }
input[type=file]::file-selector-button {
    background: var(--bg-panel-hover);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    margin-right: 12px;
    font-family: var(--font-body);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s var(--ease);
}
input[type=file]::file-selector-button:hover { background: var(--bg-panel); }

a:focus-visible, .btn:focus-visible, .btn-secondary:focus-visible, .nav-item:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn, button[type=submit] {
    background: var(--accent-grad);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 16px;
    box-shadow: var(--shadow-sm);
    transition: filter .12s var(--ease), transform .12s var(--ease);
}
.btn:hover, button[type=submit]:hover { filter: brightness(1.08); }
.btn:active, button[type=submit]:active { transform: scale(.98); }

.btn-secondary {
    background: var(--bg-panel-hover);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    transition: background .15s var(--ease), border-color .15s var(--ease);
}
.btn-secondary:hover { background: var(--bg-panel); border-color: var(--text-faint); }
.btn-perigo { background: var(--danger); }
.btn-perigo:hover { filter: brightness(1.1); }

/* Ícones dentro de botões (.btn / .btn-secondary) */
.btn svg, .btn-secondary svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Bloco de ações logo abaixo dos cards do dashboard: respiro extra
   acima/abaixo pra não colar nos stat-cards nem no título seguinte */
.acoes-dashboard { margin-top: 4px; margin-bottom: 34px; }

/* Estado vazio (painéis "nenhum registro ainda") com ícone centralizado */
.estado-vazio {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 24px;
}
.estado-vazio-icon {
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-faint);
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 14px;
}
.estado-vazio-icon svg { width: 20px; height: 20px; }
.estado-vazio .vazio { line-height: 1.6; }

.erro   { background: var(--danger-soft); color: var(--danger); padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid rgba(255,84,112,.25); }
.sucesso{ background: var(--ok-soft); color: var(--ok); padding: 11px 15px; border-radius: var(--radius-sm); font-size: 13.5px; margin-bottom: 16px; border: 1px solid rgba(45,212,167,.25); }
.vazio  { color: var(--text-faint); font-size: 13.5px; }
.ajuda  { color: var(--text-muted); font-size: 13px; }

/* ============================================================
   TABELAS (com scroll horizontal responsivo)
   ============================================================ */

.tabela, .tabela-detalhes {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.tabela tbody, .tabela thead, .tabela tr,
.tabela-detalhes tbody, .tabela-detalhes tr { display: table; width: 100%; table-layout: fixed; }
.tabela th, .tabela td, .tabela-detalhes th, .tabela-detalhes td {
    text-align: left;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-soft);
    font-size: 13.5px;
    word-break: break-word;
}
.tabela thead th { color: var(--text-faint); font-size: 11.5px; text-transform: uppercase; letter-spacing: .5px; font-weight: 600; background: var(--bg-elevated); }
.tabela tbody tr:last-child td, .tabela-detalhes tr:last-child td { border-bottom: none; }
.tabela tbody tr { transition: background .12s var(--ease); }
.tabela tbody tr:hover { background: var(--bg-panel-hover); }
.tabela-detalhes th { width: 160px; background: var(--bg-elevated); color: var(--text-muted); font-weight: 600; }

.slug { color: var(--text-faint); font-size: 11.5px; font-family: var(--font-display); word-break: break-all; }
.apikey { font-size: 12px; color: var(--text-muted); font-family: var(--font-display); word-break: break-all; }
.acoes { margin-bottom: 18px; display: flex; flex-wrap: wrap; gap: 10px; }

.badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 11px; border-radius: 20px; font-size: 11.5px; font-weight: 600;
    white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-ok .badge-dot { background: var(--ok); }
.badge-update { background: var(--warn-soft); color: var(--warn); }
.badge-update .badge-dot { background: var(--warn); }
.badge-neutro { background: var(--bg-panel-hover); color: var(--text-faint); }
.badge-neutro .badge-dot { background: var(--text-faint); }

code { font-family: var(--font-display); background: var(--bg-input); padding: 1px 6px; border-radius: 4px; font-size: .93em; }

/* System picker (enviar-versao.php) */
.sistema-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sistema-picker-item {
    background: var(--bg-panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    transition: border-color .15s var(--ease);
}
.sistema-picker-item:hover { border-color: var(--accent); }
.sistema-picker-item strong { display: block; font-size: 14px; margin-bottom: 3px; }

/* ============================================================
   RESPONSIVO
   ============================================================ */

/* Tablets — sidebar mais estreita */
@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

/* Sidebar vira barra superior horizontal (sem depender de JS) */
@media (max-width: 880px) {
    :root { --sidebar-w: 0px; }

    .sidebar {
        position: sticky;
        top: 0;
        left: auto;
        width: 100%;
        height: auto;
        flex-direction: row;
        align-items: center;
        border-right: none;
        border-bottom: 1px solid var(--border);
        z-index: 30;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .sidebar-brand { border-bottom: none; border-right: 1px solid var(--border-soft); flex-shrink: 0; padding: 14px 16px; }
    .sidebar-nav { flex: none; display: flex; align-items: center; padding: 8px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; }
    .sidebar-section-label { display: none; }
    .nav-item { margin-bottom: 0; margin-right: 4px; white-space: nowrap; }
    .sidebar-footer { border-top: none; border-left: 1px solid var(--border-soft); padding: 8px 12px; flex-shrink: 0; }
    .sidebar-footer .nav-item span { display: none; }

    .app-main { margin-left: 0; }

    .topbar { padding: 0 16px; }
    .app-content { padding: 18px; }

    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .sistema-picker { grid-template-columns: 1fr; }
}

/* Celulares pequenos */
@media (max-width: 560px) {
    html, body { font-size: 13.5px; }

    .topbar { height: auto; min-height: var(--topbar-h); padding: 12px 14px; flex-wrap: wrap; row-gap: 8px; }
    .topbar h1 { font-size: 15px; white-space: normal; }
    .topbar-right { width: 100%; justify-content: flex-start; }

    .app-content { padding: 14px; }

    .stat-grid { grid-template-columns: 1fr; gap: 10px; }
    .stat-card { padding: 16px 18px; }

    .panel { padding: 18px 16px; }
    .form-box { max-width: 100%; }

    .acoes { flex-direction: column; align-items: stretch; }
    .acoes .btn, .acoes .btn-secondary { width: 100%; }

    .sistema-picker-item { flex-direction: column; align-items: flex-start; }
    .sistema-picker-item .btn, .sistema-picker-item .btn-secondary { width: 100%; margin-top: 10px; }

    .login-box { padding: 28px 20px; }

    .tabela th, .tabela td, .tabela-detalhes th, .tabela-detalhes td { padding: 10px 12px; }
}

/* Telas grandes — respiro extra */
@media (min-width: 1440px) {
    .app-content { max-width: 1320px; }
}