﻿/* ============================================================
   CEPRODENT — Sistema de Diseño Académico Unificado
   Paleta: Academia Nórdica (Royal Blue & Slate)
   Soporte: Modo Claro (por defecto) + Modo Oscuro + Detección Automática
   ============================================================ */

:root, [data-theme="light"] {
  --bg: #f8fafc;
  --bg-subtle: #f1f5f9;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --brand: #2563eb;
  --brand-hover: #1d4ed8;
  --brand-light: rgba(37, 99, 235, 0.08);
  --brand-ring: rgba(37, 99, 235, 0.2);
  --accent: #4f46e5;
  --accent-light: rgba(79, 70, 229, 0.08);
  --success: #059669;
  --success-light: #ecfdf5;
  --success-border: #a7f3d0;
  --warn: #d97706;
  --warn-light: #fffbeb;
  --warn-border: #fde68a;
  --danger: #dc2626;
  --danger-light: #fef2f2;
  --danger-border: #fecaca;
  --info: #0284c7;
  --info-light: #f0f9ff;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.07), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --theme-btn-bg: #e2e8f0;
  --theme-btn-text: #334155;
  --input-bg: #ffffff;
  --input-border: #cbd5e1;
}

[data-theme="dark"] {
  --bg: #0b0f19;
  --bg-subtle: #0f1523;
  --surface: #131b2e;
  --surface-raised: #18223a;
  --surface-hover: #1e2a47;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --brand: #3b82f6;
  --brand-hover: #60a5fa;
  --brand-light: rgba(59, 130, 246, 0.14);
  --brand-ring: rgba(59, 130, 246, 0.28);
  --accent: #6366f1;
  --accent-light: rgba(99, 102, 241, 0.15);
  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --success-border: rgba(16, 185, 129, 0.25);
  --warn: #f59e0b;
  --warn-light: rgba(245, 158, 11, 0.12);
  --warn-border: rgba(245, 158, 11, 0.25);
  --danger: #ef4444;
  --danger-light: rgba(239, 68, 68, 0.12);
  --danger-border: rgba(239, 68, 68, 0.25);
  --info: #38bdf8;
  --info-light: rgba(56, 189, 248, 0.12);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
  --theme-btn-bg: #1e293b;
  --theme-btn-text: #cbd5e1;
  --input-bg: #101726;
  --input-border: rgba(255, 255, 255, 0.12);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg: #0b0f19;
    --bg-subtle: #0f1523;
    --surface: #131b2e;
    --surface-raised: #18223a;
    --surface-hover: #1e2a47;
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.16);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --brand: #3b82f6;
    --brand-hover: #60a5fa;
    --brand-light: rgba(59, 130, 246, 0.14);
    --brand-ring: rgba(59, 130, 246, 0.28);
    --accent: #6366f1;
    --accent-light: rgba(99, 102, 241, 0.15);
    --success: #10b981;
    --success-light: rgba(16, 185, 129, 0.12);
    --success-border: rgba(16, 185, 129, 0.25);
    --warn: #f59e0b;
    --warn-light: rgba(245, 158, 11, 0.12);
    --warn-border: rgba(245, 158, 11, 0.25);
    --danger: #ef4444;
    --danger-light: rgba(239, 68, 68, 0.12);
    --danger-border: rgba(239, 68, 68, 0.25);
    --info: #38bdf8;
    --info-light: rgba(56, 189, 248, 0.12);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.6);
    --theme-btn-bg: #1e293b;
    --theme-btn-text: #cbd5e1;
    --input-bg: #101726;
    --input-border: rgba(255, 255, 255, 0.12);
  }
}

/* Control de tema (Theme Switcher Widget) */
.theme-switch-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--theme-btn-bg);
  color: var(--theme-btn-text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  user-select: none;
}
.theme-switch-btn:hover {
  border-color: var(--brand);
  color: var(--brand);
}
.theme-switch-btn:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* Tablas responsive */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* Focus visible accesible para teclado */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--brand) !important;
  outline-offset: 2px !important;
}

/* Skip link para lectores de pantalla */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
