/*
Theme Name: Gestao de Bots
Version: 3.2.0
Requires at least: 6.0
Requires PHP: 8.0
Text Domain: gestao-bots
*/

/* ================================================================
   TOKENS
   ================================================================ */
:root {
  --gb-green:       #16A34A;
  --gb-green-dk:    #15803D;
  --gb-green-soft:  #F0FDF4;
  --gb-green-mid:   #BBF7D0;
  --gb-red:         #DC2626;
  --gb-red-soft:    #FEF2F2;
  --gb-amber:       #D97706;
  --gb-blue:        #2563EB;

  --gb-nav-bg:      #0F172A;
  --gb-nav-w:       224px;

  --gb-bg:          #F1F5F9;
  --gb-surface:     #FFFFFF;
  --gb-border:      #E2E8F0;
  --gb-border-soft: #F1F5F9;

  --gb-text:        #0F172A;
  --gb-text-2:      #475569;
  --gb-text-3:      #94A3B8;

  --f-head: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  --f-mono: 'JetBrains Mono', 'Courier New', monospace;
}

/* ================================================================
   BASE
   ================================================================ */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .875rem;
  color: var(--gb-text);
  background: var(--gb-bg);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5 { font-family: var(--f-head); font-weight: 700; margin: 0; }
a { color: var(--gb-green); }
a:hover { color: var(--gb-green-dk); }

.font-mono {
  font-family: var(--f-mono) !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
}
.eyebrow {
  font-family: var(--f-mono);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--gb-green);
  display: block;
  margin-bottom: 4px;
}
.page-title { font-size: 1.5rem; font-weight: 800; color: var(--gb-text); }
.text-positive { color: var(--gb-green) !important; }
.text-negative { color: var(--gb-red)   !important; }

/* ================================================================
   SIDEBAR
   ================================================================ */
.gb-sidebar {
  width: var(--gb-nav-w) !important;
  background: var(--gb-nav-bg);
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.06);
}

/* Desktop: fixo à esquerda */
@media (min-width: 992px) {
  .gb-sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0;
    height: 100vh;
    overflow-y: auto;
    transform: none !important;
    visibility: visible !important;
    z-index: 1040;
  }
  .gb-main { margin-left: var(--gb-nav-w); }
}

/* Mobile: offcanvas (Bootstrap controla) */
@media (max-width: 991.98px) {
  .gb-sidebar { border-right: none; }
  .gb-main { margin-left: 0; }
}

/* Brand */
.gb-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,.06);
  text-decoration: none;
  flex-shrink: 0;
}
.gb-brand-mark {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--gb-green);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  color: #fff; font-size: .9rem;
}
.gb-brand-name {
  font-family: var(--f-head); font-weight: 800;
  font-size: .85rem; color: #fff; line-height: 1.2;
}
.gb-brand-sub { font-size: .62rem; color: rgba(255,255,255,.3); font-weight: 400; }

/* Nav */
.gb-nav { flex: 1; padding: 10px 10px; overflow-y: auto; }
.gb-nav-section-label {
  font-size: .6rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: rgba(255,255,255,.22);
  padding: 12px 8px 5px;
}
.gb-nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px;
  color: rgba(255,255,255,.48); font-size: .8rem; font-weight: 500;
  text-decoration: none; transition: all .14s; margin-bottom: 1px;
  border: none; background: none; cursor: pointer; width: 100%;
}
.gb-nav-link:hover { color: rgba(255,255,255,.88); background: rgba(255,255,255,.07); }
.gb-nav-link.active { color: #fff; background: var(--gb-green); font-weight: 600; }
.gb-nav-link i { font-size: .95rem; flex-shrink: 0; }
.gb-nav-sep { height: 1px; background: rgba(255,255,255,.06); margin: 6px 0; }

/* Footer */
.gb-nav-footer { padding: 10px 10px 14px; border-top: 1px solid rgba(255,255,255,.06); flex-shrink: 0; }
.gb-user-info { display: flex; align-items: center; gap: 9px; padding: 6px 8px 10px; }
.gb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gb-green); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; flex-shrink: 0;
}
.gb-user-name { font-size: .78rem; font-weight: 600; color: rgba(255,255,255,.7); max-width: 128px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gb-user-role { font-size: .6rem; color: rgba(255,255,255,.28); }
.gb-logout {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px; border-radius: 8px;
  color: rgba(255,255,255,.28); font-size: .78rem;
  text-decoration: none; transition: all .14s;
}
.gb-logout:hover { color: #f87171; background: rgba(239,68,68,.1); }

/* Topbar mobile */
.gb-topbar {
  background: var(--gb-nav-bg);
  padding: 0 16px;
  height: 54px;
  display: none;
  align-items: center;
  justify-content: space-between;
  position: sticky; top: 0; z-index: 1030;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.gb-topbar-name { font-family: var(--f-head); font-size: .85rem; font-weight: 800; color: #fff; }
@media (max-width: 991.98px) { .gb-topbar { display: flex; } }

/* ================================================================
   PAGE
   ================================================================ */
.gb-main { min-height: 100vh; }
.gb-page { padding: 26px 24px 60px; }
@media (max-width: 767.98px) { .gb-page { padding: 18px 14px 48px; } }
@media (max-width: 575.98px) { .gb-page { padding: 14px 12px 40px; } }

/* ================================================================
   CARDS
   ================================================================ */
.card {
  background: var(--gb-surface);
  border: 1px solid var(--gb-border) !important;
  border-radius: 12px !important;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 13px 18px;
  background: var(--gb-surface) !important;
  border-bottom: 1px solid var(--gb-border-soft) !important;
  border-radius: 12px 12px 0 0 !important;
}
.card-header h2, .card-header h3 {
  font-size: .88rem; font-weight: 700; margin: 0;
  display: flex; align-items: center; gap: 7px;
}
.card-header h2 i, .card-header h3 i { color: var(--gb-green); }
.card-body { padding: 18px; }
.card-body-sm { padding: 14px 18px; }

/* ================================================================
   KPI CARDS
   ================================================================ */
.kpi-card {
  background: var(--gb-surface);
  border: 1px solid var(--gb-border);
  border-radius: 12px;
  padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.kpi-card::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0;
  height: 3px; background: var(--gb-border-soft);
}
.kpi-card.kpi-primary::after { background: var(--gb-green); }
.kpi-card.kpi-success::after { background: #22C55E; }
.kpi-card.kpi-danger::after  { background: var(--gb-red); }
.kpi-dark {
  background: var(--gb-nav-bg) !important;
  border-color: #1E293B !important;
}
.kpi-dark .kpi-label { color: rgba(255,255,255,.38); }
.kpi-dark .kpi-value { color: #fff; }
.kpi-dark .kpi-foot  { color: rgba(255,255,255,.22); }
.kpi-icon {
  width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: .95rem; margin-bottom: 4px;
}
.ki-green { background: #F0FDF4; color: var(--gb-green); }
.ki-red   { background: #FEF2F2; color: var(--gb-red); }
.ki-blue  { background: #EFF6FF; color: var(--gb-blue); }
.ki-amber { background: #FFFBEB; color: var(--gb-amber); }
.ki-slate { background: #F1F5F9; color: #64748B; }
.kpi-label { font-size: .63rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--gb-text-3); }
.kpi-value { font-family: var(--f-mono); font-size: 1.35rem; font-weight: 700; line-height: 1.15; color: var(--gb-text); }
.kpi-foot  { font-size: .68rem; color: var(--gb-text-3); }

/* ================================================================
   DATA TABLE
   ================================================================ */
.table-gb { margin: 0; font-size: .82rem; }
.table-gb thead tr { border-bottom: 1.5px solid var(--gb-border); }
.table-gb thead th {
  font-family: var(--f-mono); font-size: .62rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--gb-text-3);
  padding: 10px 14px; background: #fff; white-space: nowrap;
  border: none; vertical-align: bottom;
}
.table-gb thead th.text-end { text-align: right; }
.table-gb tbody tr { border-bottom: 1px solid var(--gb-border-soft); transition: background .1s; }
.table-gb tbody tr:last-child { border-bottom: none; }
.table-gb tbody tr:hover { background: #FAFBFC; }
.table-gb tbody td { padding: 10px 14px; border: none; vertical-align: middle; color: var(--gb-text-2); }
.table-gb tbody td.td-primary { font-weight: 600; color: var(--gb-text); }
.table-gb tbody td.td-mono    { font-family: var(--f-mono); font-size: .78rem; }
.table-gb tbody td.td-muted   { color: var(--gb-text-3); font-size: .75rem; }
.table-gb tbody td.text-end   { text-align: right; }
.table-actions { display: flex; align-items: center; gap: 5px; justify-content: flex-end; }
.cell-stack    { display: flex; flex-direction: column; gap: 3px; }

/* ================================================================
   BADGES
   ================================================================ */
.badge { font-size: .68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge-green  { background: #D1FAE5; color: #065F46; }
.badge-red    { background: #FEE2E2; color: #991B1B; }
.badge-amber  { background: #FEF3C7; color: #92400E; }
.badge-blue   { background: #DBEAFE; color: #1E40AF; }
.badge-neutral{ background: #F1F5F9; color: #475569; }
.tag-mercado {
  display: inline-block; background: var(--gb-green-soft); color: var(--gb-green-dk);
  border: 1px solid var(--gb-green-mid); border-radius: 999px;
  padding: 2px 9px; font-size: .68rem; font-weight: 600; white-space: nowrap;
}
.tag-padrao-off {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: .65rem; font-weight: 600; color: var(--gb-amber);
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn { font-family: 'Inter', sans-serif; font-weight: 600; font-size: .8rem; border-radius: 8px; }
.btn-sm { font-size: .75rem; border-radius: 6px; }
.btn-lg { font-size: .9rem; border-radius: 10px; }
.btn-primary { background: var(--gb-green) !important; border-color: var(--gb-green) !important; color: #fff !important; }
.btn-primary:hover { background: var(--gb-green-dk) !important; border-color: var(--gb-green-dk) !important; }
.btn-success { background: #22C55E !important; border-color: #22C55E !important; color: #fff !important; }
.btn-danger  { background: var(--gb-red)  !important; border-color: var(--gb-red)  !important; color: #fff !important; }
.btn-danger:hover { background: #B91C1C !important; border-color: #B91C1C !important; }
.btn-pdf { background: #DC2626 !important; border-color: #DC2626 !important; color: #fff !important; }
.btn-pdf:hover { background: #B91C1C !important; border-color: #B91C1C !important; }

/* ================================================================
   FORMS
   ================================================================ */
.form-label { font-size: .75rem; font-weight: 600; color: var(--gb-text-2); margin-bottom: 4px; }
.form-control, .form-select {
  font-size: .82rem; border-radius: 8px;
  border: 1.5px solid var(--gb-border);
  color: var(--gb-text); transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--gb-green);
  box-shadow: 0 0 0 3px rgba(22,163,74,.12);
  outline: none;
}
.form-control.is-mono { font-family: var(--f-mono); }
.form-text { font-size: .72rem; color: var(--gb-text-3); }

/* ================================================================
   ALERTS
   ================================================================ */
.alert {
  font-size: .82rem; border-radius: 8px;
  display: flex; align-items: flex-start; gap: 8px;
  border-left-width: 4px !important;
}
.alert i { flex-shrink: 0; margin-top: .1rem; }
.alert-success { background: #F0FDF4; color: #15803D; border-color: #22C55E !important; }
.alert-danger  { background: #FEF2F2; color: #991B1B; border-color: var(--gb-red) !important; }
.alert-warning { background: #FFFBEB; color: #92400E; border-color: var(--gb-amber) !important; }
.alert-info    { background: #EFF6FF; color: #1E40AF; border-color: var(--gb-blue) !important; }

/* ================================================================
   TABS (period selector)
   ================================================================ */
.gb-period-bar { display: flex; flex-wrap: wrap; gap: 6px; }
.gb-period-btn {
  display: inline-block; padding: 5px 14px; border-radius: 999px;
  font-size: .75rem; font-weight: 600; color: var(--gb-text-2);
  background: var(--gb-surface); border: 1.5px solid var(--gb-border);
  cursor: pointer; text-decoration: none; transition: all .14s; white-space: nowrap;
}
.gb-period-btn:hover { border-color: #94A3B8; color: var(--gb-text); }
.gb-period-btn.active { background: var(--gb-nav-bg); color: #fff; border-color: var(--gb-nav-bg); }
.gb-period-meta { font-family: var(--f-mono); font-size: .68rem; color: var(--gb-text-3); padding-top: 6px; }

/* ================================================================
   RESOLVE POPOVER (apostas)
   ================================================================ */
.resolve-wrap { position: relative; display: inline-block; }
.resolve-wrap > summary { list-style: none; cursor: pointer; }
.resolve-wrap > summary::-webkit-details-marker { display: none; }
.resolve-dropdown {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 600;
  background: #fff; border: 1px solid var(--gb-border);
  border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.1);
  padding: 6px; min-width: 168px;
}
.r-btn {
  width: 100%; border: none; cursor: pointer; border-radius: 7px;
  padding: 7px 11px; font-size: .78rem; font-weight: 600;
  text-align: left; display: flex; align-items: center; gap: 7px;
  transition: all .14s; font-family: 'Inter', sans-serif; margin-bottom: 2px;
}
.r-btn-green  { background: #D1FAE5; color: #065F46; }
.r-btn-green:hover  { background: var(--gb-green); color: #fff; }
.r-btn-red    { background: #FEE2E2; color: #991B1B; }
.r-btn-red:hover    { background: var(--gb-red); color: #fff; }
.r-btn-void   { background: #F1F5F9; color: #475569; }
.r-btn-void:hover   { background: #475569; color: #fff; }
.r-cashout { border-top: 1px solid var(--gb-border-soft); padding-top: 7px; margin-top: 4px; }
.r-cashout-label { font-size: .65rem; font-weight: 600; color: var(--gb-text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }

/* ================================================================
   CHART
   ================================================================ */
.chart-wrap { position: relative; height: 200px; width: 100%; }
@media (max-width: 575.98px) { .chart-wrap { height: 160px; } }

/* ================================================================
   AUTH PAGES
   ================================================================ */
body.auth-page {
  background: linear-gradient(150deg, #0C1528 0%, #1a2d47 100%);
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-logo-mark {
  width: 40px; height: 40px; background: var(--gb-green); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1rem;
}
.auth-card-body { padding: 34px 30px; }
.auth-card h1 { font-size: 1.35rem; }
.auth-subtitle { font-size: .82rem; color: var(--gb-text-3); margin: 4px 0 20px; }
.auth-footer-link { text-align: center; font-size: .78rem; color: var(--gb-text-3); margin-top: 18px; }
@media (max-width: 480px) { .auth-card-body { padding: 24px 20px; } }

/* ================================================================
   INFO BOXES (inside cards)
   ================================================================ */
.info-box {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-radius: 8px; font-size: .82rem; margin-bottom: 16px;
}
.info-box i { font-size: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.info-box strong { display: block; font-weight: 600; margin-bottom: 2px; }
.info-box p { margin: 0; opacity: .8; font-size: .78rem; }
.info-box-danger  { background: #FEF2F2; color: #991B1B; border: 1px solid #FCA5A5; }
.info-box-success { background: #F0FDF4; color: #15803D; border: 1px solid var(--gb-green-mid); }
.info-box-info    { background: #EFF6FF; color: #1E40AF; border: 1px solid #BFDBFE; }

/* ================================================================
   EMPTY STATE
   ================================================================ */
.gb-empty {
  padding: 40px 20px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.gb-empty-icon {
  width: 48px; height: 48px; border-radius: 12px;
  background: var(--gb-border-soft);
  display: flex; align-items: center; justify-content: center;
  color: var(--gb-text-3); font-size: 1.3rem; margin-bottom: 4px;
}
.gb-empty-title { font-size: .88rem; font-weight: 600; color: var(--gb-text); }
.gb-empty-sub   { font-size: .78rem; color: var(--gb-text-3); }

/* ================================================================
   PRINT
   ================================================================ */
@media print {
  .gb-topbar, .gb-sidebar, .td-actions, .btn-pdf,
  .resolve-wrap, .page-header-actions { display: none !important; }
  .gb-main { margin-left: 0 !important; }
}

/* ================================================================
   MOBILE-FIRST ADDITIONS
   ================================================================ */

/* Bottom navigation — substitui sidebar no mobile */
.gb-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 1050;
  background: var(--gb-nav-bg);
  border-top: 1px solid rgba(255,255,255,.06);
  height: 58px;
}
.gb-bottom-nav-inner { display: flex; height: 100%; }
.gb-bottom-nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 2px; text-decoration: none;
  color: rgba(255,255,255,.35); font-size: .6rem; font-weight: 600;
  transition: color .15s; -webkit-tap-highlight-color: transparent;
}
.gb-bottom-nav-item i { font-size: 1.2rem; }
.gb-bottom-nav-item.active { color: var(--gb-green); }
.gb-bottom-nav-item:hover { color: rgba(255,255,255,.7); }

@media (max-width: 991.98px) {
  .gb-bottom-nav { display: block; }
  .gb-main { padding-bottom: 70px; }
}

/* Hero card de banca (mobile dashboard) */
.banca-hero {
  background: var(--gb-nav-bg);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 0;
}
.banca-hero-valor {
  font-family: var(--f-mono); font-size: 2rem; font-weight: 700;
  color: #fff; line-height: 1.1;
}
.banca-hero-sub { font-size: .72rem; color: rgba(255,255,255,.3); margin-top: 6px; }

/* App card (usado em mobile no lugar de tabelas) */
.app-card-list { display: flex; flex-direction: column; gap: 10px; }
.app-card-item {
  background: var(--gb-surface);
  border: 1px solid var(--gb-border);
  border-radius: 14px;
  overflow: hidden;
}
.app-card-header { padding: 12px 14px 10px; }
.app-card-title { font-size: .88rem; font-weight: 600; color: var(--gb-text); }
.app-card-sub   { font-size: .72rem; color: var(--gb-text-3); margin-top: 3px; }
.app-card-stats {
  display: grid; gap: 4px;
  background: var(--gb-border-soft);
  border-top: 1px solid var(--gb-border);
  padding: 10px 14px;
}
.app-card-stat-label { font-size: .62rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--gb-text-3); }
.app-card-stat-val   { font-family: var(--f-mono); font-size: .82rem; font-weight: 700; color: var(--gb-text); margin-top: 1px; }
.app-card-actions {
  padding: 10px 14px;
  border-top: 1px solid var(--gb-border);
  display: flex; gap: 8px;
}

/* FAB */
.gb-fab {
  position: fixed; bottom: 74px; right: 16px; z-index: 1040;
  display: none;
  background: var(--gb-green);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: .85rem; font-weight: 700;
  align-items: center; gap: 6px;
  box-shadow: 0 4px 20px rgba(22,163,74,.4);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform .15s;
}
.gb-fab:active { transform: scale(.95); }
@media (max-width: 991.98px) { .gb-fab { display: inline-flex; } }

/* Filtro scroll horizontal */
.filter-scroll {
  display: flex; gap: 8px; overflow-x: auto; padding: 0 4px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.filter-scroll::-webkit-scrollbar { display: none; }
.filter-chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 999px;
  font-size: .75rem; font-weight: 600;
  border: 1.5px solid var(--gb-border);
  color: var(--gb-text-2); background: var(--gb-surface);
  text-decoration: none; transition: all .14s;
  white-space: nowrap;
}
.filter-chip:hover { border-color: #94A3B8; color: var(--gb-text); }
.filter-chip.active { background: var(--gb-nav-bg); color: #fff; border-color: var(--gb-nav-bg); }

/* Oculta tabela e mostra cards em mobile */
@media (max-width: 767.98px) {
  .table-mobile-hide { display: none !important; }
  .cards-mobile-show { display: flex !important; }
  .gb-page { padding: 14px 12px 80px; }
}
@media (min-width: 768px) {
  .table-mobile-hide { display: block; }
  .cards-mobile-show { display: none !important; }
}

/* Resolve buttons (apostas) */
.resolve-btn-group { display: flex; gap: 6px; flex-wrap: wrap; }
.resolve-btn-group .r-btn { flex: 1; min-width: 64px; justify-content: center; }
