/* =============================================================================
   RB MÍDIA · Analytics — Painel administrativo
   Identidade visual baseada em rbmidia.com.br (dark + accent limão #c4ff4a)
   Fontes: Sora (títulos) · Inter (corpo)
   ============================================================================= */

:root {
    --bg-dark:        #0a0a0a;
    --bg-dark-2:      #111111;
    --bg-card:        #161616;
    --bg-card-2:      #1c1c1c;
    --bg-light:       #f5f2ec;
    --text-white:     #ffffff;
    --text-gray:      #a0a0a0;
    --text-gray-light:#c0c0c0;
    --text-dark:      #1a1a1a;
    --accent:         #c4ff4a;
    --accent-hover:   #d8ff7a;
    --accent-2:       #4ac1ff;
    --danger:         #ff5a5a;
    --warning:        #ffb648;
    --success:        #c4ff4a;
    --border-subtle:  rgba(255, 255, 255, 0.08);
    --border-hover:   rgba(255, 255, 255, 0.16);
    --radius-sm:      8px;
    --radius-md:      16px;
    --radius-lg:      24px;
    --font-heading:   'Sora', system-ui, -apple-system, sans-serif;
    --font-body:      'Inter', system-ui, -apple-system, sans-serif;
    --transition:     all 0.3s cubic-bezier(0.22, 1, 0.36, 1);
    --sidebar-width:  256px;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg-dark);
    color: var(--text-white);
    -webkit-font-smoothing: antialiased;
    font-size: 15px;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, .h-font { font-family: var(--font-heading); }

a { color: var(--accent-2); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent); }

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

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-dark); }
::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }

/* =============================================================================
   LOGIN
   ============================================================================= */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(196, 255, 74, 0.10), transparent 60%),
        radial-gradient(1000px 500px at 100% 110%, rgba(74, 193, 255, 0.10), transparent 55%),
        var(--bg-dark);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.login-header {
    padding: 40px 40px 8px;
    text-align: center;
}
.login-header img { height: 34px; width: auto; margin-bottom: 18px; }
.login-logos {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.login-logos img { margin-bottom: 0; }
.login-logos .logo-rb { height: 38px; }
.login-logos .logo-ga { height: 38px; }
.login-logos .logo-plus {
    width: 30px; height: 30px;
    border-radius: 50%;
    background: rgba(196, 255, 74, 0.12);
    color: var(--accent);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    flex-shrink: 0;
}
.login-header .subtitle {
    color: var(--accent);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin: 0;
}
.login-body { padding: 24px 40px 40px; }

/* =============================================================================
   LAYOUT (sidebar + conteúdo)
   ============================================================================= */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-dark-2);
    border-right: 1px solid var(--border-subtle);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1030;
    transition: transform 0.3s ease;
}
.sidebar__brand {
    padding: 26px 24px;
    border-bottom: 1px solid var(--border-subtle);
}
.sidebar__brand img { height: 28px; width: auto; }
.sidebar__nav { padding: 16px 12px; flex: 1; overflow-y: auto; }
.sidebar__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    color: var(--text-gray);
    font-weight: 500;
    font-size: 14px;
    margin-bottom: 4px;
    transition: var(--transition);
}
.sidebar__link i { width: 20px; text-align: center; font-size: 15px; }
.sidebar__link:hover { background: var(--bg-card); color: var(--text-white); }
.sidebar__link.active { background: var(--accent); color: var(--bg-dark); font-weight: 600; }
.sidebar__footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-subtle);
    font-size: 13px;
    color: var(--text-gray);
}

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

.topbar {
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 1020;
}
.topbar__title { font-size: 18px; font-weight: 700; margin: 0; }
.topbar__user { display: flex; align-items: center; gap: 12px; color: var(--text-gray); font-size: 14px; }
.topbar__avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--accent);
    color: var(--bg-dark);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-family: var(--font-heading);
}

.content { padding: 28px; max-width: 1240px; width: 100%; }

.page-head { margin-bottom: 24px; }
.page-head h1 { font-size: 26px; font-weight: 700; margin: 0 0 4px; }
.page-head p { color: var(--text-gray); margin: 0; font-size: 14px; }

/* =============================================================================
   COMPONENTES
   ============================================================================= */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.card:hover { border-color: var(--border-hover); }
.card-body { padding: 22px; }
.card-header {
    padding: 18px 22px;
    border-bottom: 1px solid var(--border-subtle);
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* KPIs */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 22px;
    transition: var(--transition);
}
.stat:hover { transform: translateY(-3px); border-color: var(--border-hover); }
.stat__icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(196, 255, 74, 0.12);
    color: var(--accent);
    font-size: 18px;
    margin-bottom: 14px;
}
.stat__icon.blue { background: rgba(74, 193, 255, 0.12); color: var(--accent-2); }
.stat__value { font-family: var(--font-heading); font-size: 30px; font-weight: 700; line-height: 1; }
.stat__label { color: var(--text-gray); font-size: 13px; margin-top: 6px; }

/* Botões (pill, padrão RB) */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: 11px 22px;
    border-radius: 100px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    line-height: 1;
    white-space: nowrap;
}
.btn:focus { outline: none; box-shadow: 0 0 0 3px rgba(196, 255, 74, 0.25); }
.btn-primary { background: var(--accent); color: var(--bg-dark); }
.btn-primary:hover { background: var(--accent-hover); color: var(--bg-dark); transform: translateY(-2px); box-shadow: 0 8px 28px rgba(196, 255, 74, 0.22); }
.btn-ghost { background: transparent; color: var(--text-white); border-color: var(--border-hover); }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.05); border-color: rgba(255, 255, 255, 0.4); color: var(--text-white); }
.btn-blue { background: var(--accent-2); color: var(--bg-dark); }
.btn-blue:hover { filter: brightness(1.08); transform: translateY(-2px); }
.btn-danger { background: transparent; color: var(--danger); border-color: rgba(255, 90, 90, 0.4); }
.btn-danger:hover { background: rgba(255, 90, 90, 0.12); }
.btn-sm { padding: 7px 14px; font-size: 12.5px; }
.btn-icon { padding: 8px; width: 34px; height: 34px; justify-content: center; border-radius: 10px; }

/* Formulários */
.form-label { display: block; font-size: 13px; font-weight: 500; color: var(--text-gray-light); margin-bottom: 7px; }
.form-label i { color: var(--accent); margin-right: 6px; }
.form-control, .form-select {
    width: 100%;
    background: var(--bg-dark);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-white);
    padding: 12px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    transition: var(--transition);
}
.form-control:focus, .form-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(196, 255, 74, 0.12);
}
.form-control::placeholder { color: #666; }
.form-select option { background: var(--bg-dark-2); }
.input-group { display: flex; }
.input-group .form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .btn {
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    border: 1px solid var(--border-subtle);
    border-left: none;
    background: var(--bg-dark);
    color: var(--text-gray);
}
.form-hint { font-size: 12px; color: var(--text-gray); margin-top: 6px; }
.form-check { display: flex; align-items: center; gap: 9px; }
.form-check input { width: 18px; height: 18px; accent-color: var(--accent); }
.form-check label { font-size: 14px; color: var(--text-gray-light); }

/* Tabela */
.table-wrap { overflow-x: auto; border-radius: var(--radius-md); border: 1px solid var(--border-subtle); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
    background: var(--bg-dark-2);
    color: var(--text-gray);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 11px;
    letter-spacing: 1px;
    padding: 14px 16px;
    text-align: left;
    white-space: nowrap;
}
table.data tbody td { padding: 14px 16px; border-top: 1px solid var(--border-subtle); vertical-align: middle; }
table.data tbody tr { background: var(--bg-card); transition: var(--transition); }
table.data tbody tr:hover { background: var(--bg-card-2); }
table.data .cli-nome { font-weight: 600; }
table.data .cli-sub { color: var(--text-gray); font-size: 12.5px; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 11px;
    border-radius: 100px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-on { background: rgba(196, 255, 74, 0.14); color: var(--accent); }
.badge-off { background: rgba(255, 255, 255, 0.08); color: var(--text-gray); }
.badge-blue { background: rgba(74, 193, 255, 0.14); color: var(--accent-2); }
.badge-success { background: rgba(196, 255, 74, 0.14); color: var(--accent); }
.badge-error { background: rgba(255, 90, 90, 0.14); color: var(--danger); }
.badge-warning { background: rgba(255, 182, 72, 0.14); color: var(--warning); }

/* Alerts (Bootstrap-compatível) */
.alert {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    margin-bottom: 18px;
    font-size: 14px;
    display: flex;
    align-items: center;
    border: 1px solid transparent;
    position: relative;
}
.alert-success { background: rgba(196, 255, 74, 0.10); color: var(--accent); border-color: rgba(196, 255, 74, 0.25); }
.alert-danger  { background: rgba(255, 90, 90, 0.10); color: var(--danger); border-color: rgba(255, 90, 90, 0.25); }
.alert-warning { background: rgba(255, 182, 72, 0.10); color: var(--warning); border-color: rgba(255, 182, 72, 0.25); }
.alert-info    { background: rgba(74, 193, 255, 0.10); color: var(--accent-2); border-color: rgba(74, 193, 255, 0.25); }
.btn-close {
    background: none; border: none; color: inherit; opacity: 0.6;
    cursor: pointer; margin-left: auto; font-size: 18px; line-height: 1;
}
.btn-close:hover { opacity: 1; }
.btn-close::before { content: '\00d7'; }

/* Empty state */
.empty {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-gray);
}
.empty i { font-size: 42px; color: #333; margin-bottom: 14px; }

/* Utilitários */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.flex-wrap { flex-wrap: wrap; }
.mb-0 { margin-bottom: 0; }
.mb-3 { margin-bottom: 16px; }
.mb-4 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; }
.ms-auto { margin-left: auto; }
.text-gray { color: var(--text-gray); }
.text-accent { color: var(--accent); }
.w-100 { width: 100%; }
.text-center { text-align: center; }

/* Modal */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 20px;
    z-index: 1050;
    overflow-y: auto;
}
.modal-backdrop.open { display: flex; }
.modal-box {
    width: 100%;
    max-width: 560px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    animation: modalIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(-12px) scale(0.98); } to { opacity: 1; transform: none; } }
.modal-head {
    padding: 22px 24px;
    border-bottom: 1px solid var(--border-subtle);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-body { padding: 24px; }
.modal-foot {
    padding: 18px 24px;
    border-top: 1px solid var(--border-subtle);
    display: flex; justify-content: flex-end; gap: 12px;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Título de seção dentro de formulários */
.form-section-title {
    font-family: var(--font-heading);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--accent);
    margin: 6px 0 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}
.form-section-title:not(:first-child) { margin-top: 22px; }

/* Portal público de chamados (/suporte) */
.portal { max-width: 960px; margin: 0 auto; padding: 34px 20px 56px; }
.portal__top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    padding-bottom: 20px; margin-bottom: 26px;
    border-bottom: 1px solid var(--border-subtle);
}
.portal__logo { height: 32px; width: auto; }

/* Histórico / conversa dos chamados */
.chat { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.chat__msg {
    background: var(--bg-card-2);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--accent-2);
    padding: 12px 14px;
    font-size: 14px;
}
.chat__msg--eu { border-left-color: var(--accent); background: rgba(196, 255, 74, 0.05); }
.chat__meta { font-size: 12px; color: var(--text-gray); margin-bottom: 6px; }
.chat__meta strong { color: var(--text-white); font-weight: 600; }
.chat__sys { font-size: 12.5px; color: var(--text-gray-light); padding: 2px 4px; }
.chat__sys i { color: var(--accent); margin-right: 4px; }

/* Toggle sidebar (mobile) */
.menu-toggle { display: none; background: none; border: none; color: var(--text-white); font-size: 22px; cursor: pointer; }

/* =============================================================================
   RESPONSIVO
   ============================================================================= */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-toggle { display: block; }
    .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 20px 16px; }
}
