/* ═══════════════════════════════════════
   AIVizor — Design System Central
   Importar en todos los templates
═══════════════════════════════════════ */

/* ── VARIABLES ── */
:root {
  /* Paleta principal */
  --slate-900: #0F172A;
  --slate-800: #1E293B;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748B;
  --slate-400: #94A3B8;
  --slate-300: #CBD5E1;
  --slate-200: #E2E8F0;
  --slate-100: #F1F5F9;
  --slate-50:  #F8FAFC;

  /* Acento */
  --blue-600:  #2563EB;
  --blue-500:  #3B82F6;
  --blue-100:  #DBEAFE;
  --blue-50:   #EFF6FF;

  /* Semánticos */
  --green:      #10B981;
  --green-bg:   #F0FDF4;
  --green-text: #166534;
  --red:        #EF4444;
  --red-bg:     #FEF2F2;
  --red-text:   #991B1B;
  --amber:      #F59E0B;
  --amber-bg:   #FFFBEB;
  --amber-text: #92400E;
  --purple:     #7C3AED;
  --purple-bg:  #F5F3FF;
  --purple-text:#5B21B6;

  /* Superficie */
  --white:      #FFFFFF;
  --page-bg:    #F8FAFC;

  /* Tipografía */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* Radio */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;

  /* Sombra */
  --shadow-sm: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow:    0 4px 6px rgba(0,0,0,.05), 0 2px 4px rgba(0,0,0,.04);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--slate-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { text-decoration: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── LAYOUT APP ── */
.app-layout { display: flex; min-height: 100vh; }

/* ── NAVBAR OSCURA (landing + auth) ── */
.navbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--slate-900);
  border-bottom: 1px solid var(--slate-800);
}
.navbar-inner {
  max-width: 1080px; margin: 0 auto;
  padding: 0 24px; height: 56px;
  display: flex; align-items: center; justify-content: space-between;
}
.navbar-logo { display: flex; align-items: center; gap: 8px; }
.navbar-logo-icon {
  width: 26px; height: 26px; background: var(--blue-600);
  border-radius: var(--radius-sm); display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.navbar-logo-text { font-weight: 700; font-size: 15px; color: var(--white); }
.navbar-links { display: flex; align-items: center; gap: 24px; }
.navbar-links a { font-size: 13px; color: var(--slate-400); transition: color .15s; }
.navbar-links a:hover { color: var(--white); }

/* ── SIDEBAR APP ── */
.sidebar {
  width: 200px; background: var(--slate-900);
  border-right: 1px solid var(--slate-800);
  display: flex; flex-direction: column;
  flex-shrink: 0; min-height: 100vh;
  position: sticky; top: 0; height: 100vh;
  overflow-y: auto;
}
.sidebar-header {
  padding: 16px; border-bottom: 1px solid var(--slate-800);
  display: flex; align-items: center; gap: 8px;
}
.sidebar-logo-icon {
  width: 26px; height: 26px; background: var(--blue-600);
  border-radius: var(--radius-sm); display: flex; align-items: center;
  justify-content: center; color: #fff; font-weight: 700; font-size: 12px;
  flex-shrink: 0;
}
.sidebar-logo-text { font-weight: 700; font-size: 14px; color: var(--white); }
.sidebar-badge {
  font-size: 9px; background: var(--red-bg); color: var(--red);
  padding: 2px 6px; border-radius: 99px; font-weight: 600;
  margin-left: auto;
}
.sidebar-nav { padding: 8px; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.sidebar-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--slate-400);
  transition: background .15s, color .15s;
}
.sidebar-item:hover { background: var(--slate-800); color: var(--slate-200); }
.sidebar-item.active { background: var(--slate-800); color: var(--white); font-weight: 500; }
.sidebar-item i { font-size: 15px; flex-shrink: 0; }
.sidebar-item .badge-count {
  margin-left: auto; font-size: 10px; background: var(--slate-700);
  color: var(--slate-400); padding: 1px 6px; border-radius: 99px;
}
.sidebar-footer {
  padding: 8px; border-top: 1px solid var(--slate-800);
  display: flex; flex-direction: column; gap: 2px;
}
.sidebar-user {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius-sm);
}
.sidebar-user-avatar {
  width: 24px; height: 24px; background: var(--slate-700);
  border-radius: 50%; display: flex; align-items: center;
  justify-content: center; font-size: 10px; font-weight: 600;
  color: var(--slate-300); flex-shrink: 0;
}
.sidebar-user-name { font-size: 12px; color: var(--slate-400); truncate: true; }
.sidebar-credits {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; border-radius: var(--radius-sm);
  font-size: 12px; color: var(--slate-500);
}
.sidebar-credits i { font-size: 14px; }

/* ── MAIN CONTENT ── */
.main-content { flex: 1; padding: 32px; overflow-x: hidden; }
.page-header { margin-bottom: 24px; }
.page-title { font-size: 18px; font-weight: 600; color: var(--slate-900); }
.page-subtitle { font-size: 13px; color: var(--slate-500); margin-top: 2px; }

/* ── BOTONES ── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius);
  font-size: 13px; font-weight: 500; border: none;
  transition: all .15s; cursor: pointer;
}
.btn-primary { background: var(--blue-600); color: #fff; }
.btn-primary:hover { background: var(--blue-500); }
.btn-dark { background: var(--slate-900); color: #fff; }
.btn-dark:hover { background: var(--slate-700); }
.btn-outline { background: var(--white); color: var(--slate-700); border: 1px solid var(--slate-200); }
.btn-outline:hover { background: var(--slate-50); }
.btn-ghost { background: transparent; color: var(--slate-500); }
.btn-ghost:hover { background: var(--slate-100); color: var(--slate-700); }
.btn-danger { background: var(--red-bg); color: var(--red); }
.btn-danger:hover { background: #fecaca; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 14px; font-weight: 600; border-radius: var(--radius); }

/* ── CARDS ── */
.card {
  background: var(--white); border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg);
}
.card-body { padding: 20px; }
.card-header {
  padding: 14px 20px; border-bottom: 1px solid var(--slate-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 13px; font-weight: 500; color: var(--slate-700); }
.card-dark { background: var(--slate-900); border-color: var(--slate-800); }
.card-dark .card-header { border-color: var(--slate-800); }
.card-dark .card-title { color: var(--slate-200); }

/* ── STAT CARDS ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.stat-card {
  background: var(--white); border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg); padding: 16px;
}
.stat-label { font-size: 11px; color: var(--slate-400); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.stat-value { font-size: 24px; font-weight: 600; color: var(--slate-900); }
.stat-sub { font-size: 11px; color: var(--slate-400); margin-top: 3px; }
.stat-value.blue { color: var(--blue-600); }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.amber { color: var(--amber); }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 99px;
}
.badge-red    { background: var(--red-bg);    color: var(--red-text); }
.badge-amber  { background: var(--amber-bg);  color: var(--amber-text); }
.badge-green  { background: var(--green-bg);  color: var(--green-text); }
.badge-blue   { background: var(--blue-50);   color: #1D4ED8; }
.badge-purple { background: var(--purple-bg); color: var(--purple-text); }
.badge-gray   { background: var(--slate-100); color: var(--slate-600); }
.badge-dark   { background: var(--slate-800); color: var(--slate-300); }

/* ── SCORE BADGES ── */
.score-badge {
  width: 44px; height: 44px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; flex-shrink: 0;
}
.score-high   { background: var(--green-bg); color: #166534; }
.score-mid    { background: var(--amber-bg); color: var(--amber-text); }
.score-low    { background: var(--red-bg);   color: var(--red-text); }
.score-loading { background: var(--blue-50); color: var(--blue-600); }

/* ── TABLAS ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--slate-50); }
th {
  text-align: left; font-size: 11px; font-weight: 500;
  color: var(--slate-400); text-transform: uppercase; letter-spacing: .4px;
  padding: 10px 16px; border-bottom: 1px solid var(--slate-100);
}
td { font-size: 13px; color: var(--slate-600); padding: 12px 16px; border-bottom: 1px solid var(--slate-50); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--slate-50); }
.td-primary { font-weight: 500; color: var(--slate-900); }
.td-muted { font-size: 11px; color: var(--slate-400); margin-top: 1px; }

/* ── FORMULARIOS ── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 12px; font-weight: 500; color: var(--slate-700); margin-bottom: 4px; }
.form-input, .form-select {
  width: 100%; border: 1px solid var(--slate-200);
  border-radius: var(--radius); padding: 9px 12px;
  font-size: 13px; color: var(--slate-900);
  background: var(--white); transition: border-color .15s;
  outline: none;
}
.form-input:focus, .form-select:focus { border-color: var(--blue-600); box-shadow: 0 0 0 3px rgba(37,99,235,.1); }
.form-input::placeholder { color: var(--slate-300); }

/* ── ALERTS ── */
.alert {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: var(--radius);
  font-size: 13px; margin-bottom: 16px;
}
.alert i { font-size: 15px; flex-shrink: 0; }
.alert-success { background: var(--green-bg); color: var(--green-text); border: 1px solid #bbf7d0; }
.alert-error   { background: var(--red-bg);   color: var(--red-text);   border: 1px solid #fecaca; }
.alert-info    { background: var(--blue-50);  color: #1D4ED8;           border: 1px solid var(--blue-100); }

/* ── DIVIDER ── */
.divider { display: flex; align-items: center; gap: 10px; margin: 14px 0; }
.divider-line { flex: 1; height: 1px; background: var(--slate-200); }
.divider-text { font-size: 11px; color: var(--slate-400); white-space: nowrap; }

/* ── PROGRESS BAR ── */
.progress-bar { height: 5px; background: var(--slate-100); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width .3s ease; }
.progress-blue  { background: var(--blue-600); }
.progress-green { background: var(--green); }
.progress-amber { background: var(--amber); }
.progress-red   { background: var(--red); }

/* ── ANIMACIONES ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }
.spinning { animation: spin 1s linear infinite; display: inline-block; }
.pulsing  { animation: pulse 1.5s ease-in-out infinite; }

/* ── SCAN ROW ── */
.scan-row {
  background: var(--white); border: 1px solid var(--slate-200);
  border-radius: var(--radius-lg); padding: 14px 16px;
  display: flex; align-items: center; gap: 12px;
  transition: border-color .15s;
  color: inherit;
}
.scan-row:hover { border-color: var(--slate-300); }
.scan-url { font-size: 13px; font-weight: 500; color: var(--slate-900); }
.scan-meta { font-size: 11px; color: var(--slate-400); margin-top: 2px; }

/* ── UTILIDADES ── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mb-6 { margin-bottom: 24px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-muted { color: var(--slate-400); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.w-full { width: 100%; }
.hidden { display: none !important; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 16px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}