/* ======================================================
   GAUSS HABIB ADVOCACIA — Sistema de Automação IA
   Identidade Visual: Azul Marinho #1a2e4a | Dourado #c9a84c
   ====================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

:root {
  --navy:       #1a2e4a;
  --navy-dark:  #0f1e30;
  --navy-light: #243d5e;
  --gold:       #c9a84c;
  --gold-light: #e8c96a;
  --gold-dark:  #a88930;
  --white:      #ffffff;
  --bg:         #f2f4f8;
  --bg-card:    #ffffff;
  --text:       #2c3e50;
  --text-muted: #7a8499;
  --border:     #e2e8f0;
  --success:    #27ae60;
  --warning:    #f39c12;
  --danger:     #e74c3c;
  --info:       #3498db;
  --sidebar-w:  260px;
  --radius:     12px;
  --shadow:     0 2px 16px rgba(26,46,74,0.08);
  --shadow-lg:  0 8px 32px rgba(26,46,74,0.14);
  --transition: all 0.22s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy); text-decoration: none; }
a:hover { color: var(--gold); }

/* ===================== LOGIN PAGE ===================== */
.login-page {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, var(--navy-dark) 0%, var(--navy) 50%, var(--navy-light) 100%);
  position: relative;
  overflow: hidden;
}
.login-page::before {
  content: '';
  position: absolute;
  width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(201,168,76,0.12) 0%, transparent 70%);
  top: -200px; right: -200px;
  border-radius: 50%;
}
.login-page::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(201,168,76,0.08) 0%, transparent 70%);
  bottom: -100px; left: -100px;
  border-radius: 50%;
}

.login-card {
  width: 440px;
  margin: auto;
  background: rgba(255,255,255,0.97);
  border-radius: 20px;
  padding: 48px 44px;
  box-shadow: 0 24px 64px rgba(0,0,0,0.28);
  position: relative;
  z-index: 1;
  backdrop-filter: blur(10px);
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}
.login-logo .logo-icon {
  width: 72px; height: 72px;
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  border-radius: 18px;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 8px 24px rgba(26,46,74,0.3);
}
.login-logo .logo-icon svg { width: 36px; height: 36px; fill: var(--gold); }
.login-logo h1 {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  color: var(--navy);
  font-weight: 700;
  letter-spacing: -0.3px;
}
.login-logo p { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.login-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold), transparent);
  margin: 20px 0 28px;
  opacity: 0.4;
}

.form-group { margin-bottom: 20px; }
.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}
.form-control {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fafafa;
  transition: var(--transition);
  outline: none;
}
.form-control:focus {
  border-color: var(--gold);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.12);
}
.form-control::placeholder { color: #b0bac8; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--navy), var(--navy-light));
  color: var(--white);
  width: 100%;
  padding: 14px;
  font-size: 15px;
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(26,46,74,0.3);
}
.btn-primary:hover {
  background: linear-gradient(135deg, var(--navy-dark), var(--navy));
  box-shadow: 0 6px 20px rgba(26,46,74,0.4);
  transform: translateY(-1px);
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
}
.btn-gold:hover { background: linear-gradient(135deg, var(--gold-dark), var(--gold)); }
.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-icon { padding: 8px; border-radius: 8px; }

.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 13px; font-weight: 500; }
.alert-error { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }

/* ===================== LAYOUT ===================== */
.app-wrapper { display: flex; min-height: 100vh; }

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-dark) 0%, var(--navy) 100%);
  min-height: 100vh;
  position: fixed;
  left: 0; top: 0;
  display: flex; flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  box-shadow: 4px 0 20px rgba(0,0,0,0.15);
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(201,168,76,0.2);
}
.sidebar-logo .brand {
  display: flex; align-items: center; gap: 12px;
}
.sidebar-logo .brand-icon {
  width: 42px; height: 42px;
  background: rgba(201,168,76,0.15);
  border: 1px solid rgba(201,168,76,0.3);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-logo .brand-icon svg { width: 22px; height: 22px; fill: var(--gold); }
.sidebar-logo .brand-name { font-family: 'Playfair Display', serif; font-size: 15px; color: white; line-height: 1.2; }
.sidebar-logo .brand-sub { font-size: 11px; color: rgba(255,255,255,0.45); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }
.sidebar-section { margin-bottom: 8px; }
.sidebar-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: rgba(255,255,255,0.3);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: rgba(255,255,255,0.65);
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  margin-bottom: 2px;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-item.active {
  background: linear-gradient(135deg, rgba(201,168,76,0.22), rgba(201,168,76,0.08));
  color: var(--gold-light);
  border-left: 2px solid var(--gold);
}
.nav-item svg { width: 17px; height: 17px; flex-shrink: 0; opacity: 0.75; }
.nav-item.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
}
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
}
.user-avatar {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: var(--navy); font-size: 13px;
  flex-shrink: 0;
}
.user-name { font-size: 13px; font-weight: 600; color: white; }
.user-role { font-size: 11px; color: rgba(255,255,255,0.4); }
.logout-btn {
  margin-left: auto;
  background: none; border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer; padding: 4px;
  border-radius: 6px;
  transition: var(--transition);
}
.logout-btn:hover { color: #e74c3c; background: rgba(231,76,60,0.12); }

/* ===================== MAIN CONTENT ===================== */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 50;
  box-shadow: 0 1px 8px rgba(0,0,0,0.05);
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--navy); }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 3px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
}
.badge-gold { background: rgba(201,168,76,0.12); color: var(--gold-dark); }
.badge-navy { background: rgba(26,46,74,0.08); color: var(--navy); }
.badge-success { background: rgba(39,174,96,0.1); color: var(--success); }
.badge-warning { background: rgba(243,156,18,0.1); color: var(--warning); }
.badge-danger { background: rgba(231,76,60,0.1); color: var(--danger); }

.page-body { padding: 28px 32px; flex: 1; }

/* ===================== CARDS ===================== */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title {
  font-size: 15px; font-weight: 700; color: var(--navy);
  display: flex; align-items: center; gap: 10px;
}
.card-title svg { color: var(--gold); }
.card-body { padding: 24px; }

/* ===================== STAT CARDS ===================== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }

.stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 22px 24px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
  transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.stat-card.navy::before { background: var(--navy); }
.stat-card.gold::before { background: var(--gold); }
.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-icon.navy { background: rgba(26,46,74,0.08); color: var(--navy); }
.stat-icon.gold { background: rgba(201,168,76,0.12); color: var(--gold-dark); }
.stat-icon.green { background: rgba(39,174,96,0.1); color: var(--success); }
.stat-icon.orange { background: rgba(243,156,18,0.1); color: var(--warning); }
.stat-icon.red { background: rgba(231,76,60,0.1); color: var(--danger); }
.stat-icon svg { width: 22px; height: 22px; }

.stat-value { font-size: 26px; font-weight: 800; color: var(--navy); line-height: 1; margin-bottom: 4px; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 500; }
.stat-change { font-size: 11px; margin-top: 8px; display: flex; align-items: center; gap: 4px; }
.stat-change.up { color: var(--success); }
.stat-change.down { color: var(--danger); }

/* ===================== FORMS ===================== */
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; }
.form-select {
  width: 100%;
  padding: 11px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #fafafa;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237a8499' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  transition: var(--transition);
}
.form-select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.12); }
textarea.form-control { resize: vertical; min-height: 100px; }

/* ===================== TABLES ===================== */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: #f8fafc; }
th {
  text-align: left; padding: 12px 16px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.6px; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 14px 16px; border-bottom: 1px solid #f0f2f5;
  font-size: 13.5px; color: var(--text);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbfc; }

/* ===================== LOADING ===================== */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
  position: fixed; inset: 0;
  background: rgba(26,46,74,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(4px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.3s;
}
.loading-overlay.active { opacity: 1; pointer-events: all; }
.loading-box {
  background: white; border-radius: 16px; padding: 32px 40px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.loading-box .big-spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(26,46,74,0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 0 auto 16px;
}
.loading-box p { font-weight: 600; color: var(--navy); font-size: 15px; }
.loading-box span { font-size: 13px; color: var(--text-muted); }

/* ===================== TOAST ===================== */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 10000; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: white; border-radius: 12px; padding: 14px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  display: flex; align-items: center; gap: 12px;
  min-width: 300px; max-width: 420px;
  border-left: 4px solid var(--navy);
  animation: slideIn 0.3s ease;
}
.toast.success { border-color: var(--success); }
.toast.error { border-color: var(--danger); }
.toast.warning { border-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-icon { width: 20px; height: 20px; flex-shrink: 0; }
.toast-msg { flex: 1; font-size: 13.5px; font-weight: 500; color: var(--text); }
.toast-close { cursor: pointer; color: var(--text-muted); background: none; border: none; font-size: 18px; line-height: 1; padding: 2px 4px; }

/* ===================== RESULT BOX ===================== */
.result-box {
  background: #f8fafc; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  font-size: 13px; line-height: 1.7; white-space: pre-wrap;
  max-height: 400px; overflow-y: auto; font-family: 'Inter', sans-serif;
}
.result-box.success { background: #f0fdf4; border-color: #bbf7d0; }

/* ===================== SLIDE PREVIEW ===================== */
.slides-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.slide-card {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: var(--transition);
}
.slide-card:hover { border-color: var(--gold); box-shadow: 0 4px 12px rgba(201,168,76,0.2); transform: translateY(-2px); }
.slide-header {
  padding: 8px 12px; font-size: 11px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--navy); color: var(--gold);
}
.slide-body { padding: 12px; font-size: 12px; color: var(--text); background: white; }
.slide-body strong { display: block; margin-bottom: 6px; font-size: 13px; color: var(--navy); }
.slide-emoji { font-size: 20px; margin-bottom: 6px; display: block; }

/* ===================== PROGRESS ===================== */
.progress-bar {
  height: 6px; background: var(--border); border-radius: 999px; overflow: hidden;
}
.progress-fill { height: 100%; border-radius: 999px; transition: width 0.5s ease; }
.progress-fill.navy { background: var(--navy); }
.progress-fill.gold { background: var(--gold); }
.progress-fill.green { background: var(--success); }

/* ===================== TABS ===================== */
.tabs { display: flex; border-bottom: 1.5px solid var(--border); margin-bottom: 24px; gap: 4px; }
.tab {
  padding: 10px 20px; border-radius: 8px 8px 0 0;
  font-size: 13px; font-weight: 500; color: var(--text-muted);
  cursor: pointer; border: 1.5px solid transparent; border-bottom: none;
  transition: var(--transition); background: none;
}
.tab:hover { color: var(--navy); background: rgba(26,46,74,0.04); }
.tab.active {
  color: var(--navy); border-color: var(--border); border-bottom-color: white;
  background: white; font-weight: 600; margin-bottom: -1px;
}

/* ===================== SCORE METER ===================== */
.score-circle {
  width: 80px; height: 80px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800;
  border: 4px solid var(--border);
}
.score-circle.hot { border-color: var(--success); color: var(--success); background: rgba(39,174,96,0.08); }
.score-circle.warm { border-color: var(--warning); color: var(--warning); background: rgba(243,156,18,0.08); }
.score-circle.cold { border-color: var(--text-muted); color: var(--text-muted); background: rgba(122,132,153,0.08); }

/* ===================== RESPONSIVE ===================== */
@media (max-width: 768px) {
  .sidebar { width: 0; overflow: hidden; }
  .sidebar.open { width: var(--sidebar-w); }
  .main-content { margin-left: 0; }
  .page-body { padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .topbar { padding: 0 16px; }
  .login-card { width: 95%; padding: 32px 24px; }
}

/* ===================== UTILITIES ===================== */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-sm { font-size: 12px; }
.text-muted { color: var(--text-muted); }
.font-bold { font-weight: 700; }
.text-navy { color: var(--navy); }
.text-gold { color: var(--gold-dark); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.hidden { display: none !important; }
.w-full { width: 100%; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }
