/* ─────────────────────────────────────────────
   REVELA — Global Stylesheet
   Paleta: Azul navy · Gris · Blanco
   Tipografía: Sora (display) + DM Sans (body)
───────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Sora:wght@300;400;600;700&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;1,9..40,300&display=swap');

/* ── Variables ───────────────────────────────── */
:root {
  --navy:        #1B3358;
  --navy-deep:   #111F36;
  --blue:        #2C6FBF;
  --blue-mid:    #4A90D9;
  --blue-light:  #7BB3E8;
  --blue-pale:   #D6E8F8;
  --bg:          #F4F7FB;
  --bg-card:     #FFFFFF;
  --border:      #DDE4EE;
  --text:        #1A2B3C;
  --text-muted:  #6B7E96;
  --text-light:  #9AAFC4;
  --success:     #1E7D4A;
  --danger:      #B33A1E;
  --warning:     #B37D1E;

  --radius-sm:   6px;
  --radius:      12px;
  --radius-lg:   18px;
  --shadow-sm:   0 1px 4px rgba(27,51,88,0.07);
  --shadow:      0 4px 20px rgba(27,51,88,0.10);
  --shadow-lg:   0 8px 40px rgba(27,51,88,0.14);

  --transition:  180ms ease;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Tipografía ──────────────────────────────── */
h1, h2, h3, h4 {
  font-family: 'Sora', sans-serif;
  font-weight: 600;
  line-height: 1.25;
  color: var(--navy-deep);
}

h1 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h2 { font-size: clamp(1.2rem, 3vw, 1.6rem); }
h3 { font-size: 1.1rem; }

p { color: var(--text); }

small, .hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Layout helper ───────────────────────────── */
.container {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Logo ────────────────────────────────────── */
.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-mark {
  width: 40px;
  height: 40px;
  background: var(--navy);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-mark svg { width: 22px; height: 22px; }

.logo-text {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--navy-deep);
  letter-spacing: -0.02em;
}

.logo-text span { color: var(--blue); }

/* ── Navbar ──────────────────────────────────── */
.navbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

/* ── Card ────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 32px;
}

.card-sm { padding: 20px 24px; }

/* ── Form elements ───────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--navy-deep);
  font-family: 'Sora', sans-serif;
}

input[type="text"],
input[type="password"],
textarea,
select {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  appearance: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus,
select:focus {
  border-color: var(--blue-mid);
  box-shadow: 0 0 0 3px rgba(74,144,217,0.15);
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 100px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7E96' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ── Radio / Checkbox cards ──────────────────── */
.choice-group { display: flex; gap: 12px; flex-wrap: wrap; }

.choice-card {
  flex: 1;
  min-width: 140px;
  position: relative;
}

.choice-card input { display: none; }

.choice-card label {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  font-size: 0.875rem;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
  background: var(--bg);
  color: var(--text-muted);
  font-weight: 400;
}

.choice-card input:checked + label {
  border-color: var(--blue);
  background: var(--blue-pale);
  color: var(--navy);
  box-shadow: 0 0 0 3px rgba(74,144,217,0.12);
}

.choice-card label:hover {
  border-color: var(--blue-light);
  background: #fff;
  color: var(--text);
}

/* Checkboxes múltiples */
.checkbox-group { display: flex; flex-direction: column; gap: 8px; }

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  font-size: 0.875rem;
  color: var(--text);
  background: var(--bg);
}

.checkbox-item:hover {
  border-color: var(--blue-light);
  background: #fff;
}

.checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
  cursor: pointer;
  flex-shrink: 0;
}

.checkbox-item.checked {
  border-color: var(--blue);
  background: var(--blue-pale);
}

/* ── Buttons ─────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 22px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: 'Sora', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--navy);
  color: #fff;
  box-shadow: 0 2px 8px rgba(27,51,88,0.25);
}
.btn-primary:hover {
  background: var(--navy-deep);
  box-shadow: 0 4px 14px rgba(27,51,88,0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--navy);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover {
  border-color: var(--blue-light);
  background: var(--blue-pale);
}

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid rgba(179,58,30,0.3);
  font-size: 0.8rem;
  padding: 7px 14px;
}
.btn-danger:hover {
  background: rgba(179,58,30,0.06);
  border-color: var(--danger);
}

.btn-success {
  background: transparent;
  color: var(--success);
  border: 1.5px solid rgba(30,125,74,0.3);
  font-size: 0.8rem;
  padding: 7px 14px;
}
.btn-success:hover {
  background: rgba(30,125,74,0.06);
  border-color: var(--success);
}

.btn-sm { font-size: 0.78rem; padding: 7px 14px; }
.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* ── Badge de prioridad ──────────────────────── */
.badge-priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Sora', sans-serif;
  letter-spacing: 0.04em;
}

.priority-1 { background: #e8f4fd; color: #1a5c8f; }
.priority-2 { background: #e8f7ee; color: #1a6e44; }
.priority-3 { background: #fdf8e2; color: #7a5c00; }
.priority-4 { background: #fdf0e2; color: #9a4400; }
.priority-5 { background: #fde8e8; color: #9a1c00; }
.priority-pending { background: #f0f1f3; color: var(--text-muted); }

/* ── Alert messages ──────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  border: 1px solid transparent;
}
.alert-error   { background: #fff1f0; border-color: #ffc9c4; color: #9a1c00; }
.alert-success { background: #f0faf4; border-color: #b3e6c8; color: #1a5c36; }
.alert-info    { background: #f0f6fd; border-color: #b3d4f5; color: #1a4a7a; }

/* ── Tabs ────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  width: fit-content;
}

.tab-btn {
  padding: 8px 20px;
  border: none;
  border-radius: 6px;
  background: transparent;
  font-family: 'Sora', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}

.tab-btn.active {
  background: var(--bg-card);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ── Case card ───────────────────────────────── */
.case-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  transition: box-shadow var(--transition);
}

.case-card:hover { box-shadow: var(--shadow); }

.case-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.case-code {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--navy);
  letter-spacing: 0.04em;
}

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.case-meta span {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
}

.case-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
  line-height: 1.55;
}

.case-ai {
  font-size: 0.8rem;
  color: var(--blue);
  margin-top: 8px;
  font-style: italic;
}

.case-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

/* ── Stats ───────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.stat-number {
  font-family: 'Sora', sans-serif;
  font-weight: 700;
  font-size: 2rem;
  color: var(--navy);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

/* ── Search bar ──────────────────────────────── */
.search-bar {
  display: flex;
  gap: 8px;
  align-items: center;
}

.search-bar input {
  max-width: 320px;
}

/* ── Empty state ─────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--text-muted);
}

.empty-state p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 8px;
}

/* ── Section dividers ────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

/* ── Welcome hero ────────────────────────────── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.hero-content {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.hero-inner {
  max-width: 480px;
  width: 100%;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--blue-pale);
  color: var(--blue);
  border: 1px solid rgba(74,144,217,0.3);
  border-radius: 99px;
  padding: 4px 14px;
  font-size: 0.75rem;
  font-weight: 600;
  font-family: 'Sora', sans-serif;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 20px;
}

/* ── Loading spinner ─────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}

.spinner.dark {
  border-color: rgba(27,51,88,0.2);
  border-top-color: var(--navy);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Modal ───────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17,31,54,0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease;
  padding: 24px;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 36px;
  max-width: 440px;
  width: 100%;
  transform: translateY(12px);
  transition: transform 200ms ease;
}

.modal-overlay.open .modal { transform: translateY(0); }

/* ── Utility ─────────────────────────────────── */
.gap-4   { gap: 4px; }
.gap-8   { gap: 8px; }
.gap-12  { gap: 12px; }
.gap-16  { gap: 16px; }
.gap-20  { gap: 20px; }
.gap-24  { gap: 24px; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.w-full { width: 100%; }

.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }

.hidden { display: none !important; }

/* ── Responsive ──────────────────────────────── */
@media (max-width: 700px) {
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .card { padding: 20px; }
}

@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .choice-group { flex-direction: column; }
}
