/* ============================================================================
   styles.css — Capa de estilo compartida "moderna y limpia" para todo el sitio.
   Se enlaza en cada página DESPUÉS de su <style> propio, así refina/pisa lo base
   (tipografía, colores, tarjetas, botones, inputs, tablas) sin reescribir cada
   layout. Marca River (rojo) como acento sobre neutros claros.

   Cache-bust: subir styles.css?v=N en los <link> al cambiar esto.
   ============================================================================ */

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

:root {
  /* Marca */
  --river-red: #c8102e;
  --river-red-dark: #a00d25;
  --river-red-soft: #fdecee;

  /* Neutros */
  --bg: #f3f4f6;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --text-primary: #1f2430;
  --text-secondary: #6b7280;
  --border: #e6e8ec;
  --border-strong: #d5d8de;

  /* Estados */
  --success: #1b7a3d;
  --error: #d02733;
  --info: #1565c0;
  --warning: #b7791f;

  /* Forma / profundidad */
  --radius: 14px;
  --radius-sm: 10px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.06), 0 1px 3px rgba(16,24,40,.08);
  --shadow-md: 0 6px 18px rgba(16,24,40,.08);
  --shadow-lg: 0 16px 40px rgba(16,24,40,.14);
  --ring: 0 0 0 3px rgba(200,16,46,.16);
  --transition: .15s ease;

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  /* Tipografía de títulos del header: condensada estilo DIN (alternativa libre a
     DIN Next LT Pro Bold Condensed, que es licenciada). */
  --font-display: 'Oswald', 'Arial Narrow', var(--font-sans);
}

/* ===== Base ===== */
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, h4 { letter-spacing: -0.02em; }
h1 { font-weight: 800; }
h2, h3 { font-weight: 700; }
a { color: var(--river-red); }

/* ===== Encabezados de marca (barras rojas) ===== */
.header, .panel-header {
  background: linear-gradient(135deg, var(--river-red) 0%, var(--river-red-dark) 100%);
  box-shadow: var(--shadow-sm);
}
/* Título del header con tipografía condensada estilo River (Oswald ≈ DIN Cond.).
   Solo los títulos/bajadas del header rojo; el contenido y los controles del
   admin (email, botones) siguen en la tipografía base. */
.header h1, .panel-header h1, .header-text p, .login-card h2 {
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}
.header h1, .panel-header h1, .login-card h2 { font-weight: 700; }

/* ===== Tarjetas / paneles ===== */
.form-card, .card, .stat-card, .cert-card, .modo-card, .tab-content .container,
.detail-section {
  border-radius: var(--radius);
}
.form-card, .card {
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
}
.modo-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.modo-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: rgba(200,16,46,.35);
}

/* ===== Botones ===== */
.btn-action, .btn-primary, .btn-secondary, .submit-btn, .btn-descargar {
  border-radius: var(--radius-sm);
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), opacity var(--transition);
}
.btn-action:hover:not(:disabled),
.btn-primary:hover:not(:disabled),
.submit-btn:hover:not(:disabled),
.btn-descargar:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.btn-action:active, .btn-primary:active, .submit-btn:active { transform: translateY(0); }
.submit-btn, .btn-primary { box-shadow: 0 2px 8px rgba(200,16,46,.18); }

/* ===== Campos de formulario ===== */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]),
select, textarea {
  border-radius: var(--radius-sm) !important;
  border: 1px solid var(--border-strong);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus, textarea:focus {
  outline: none;
  border-color: var(--river-red);
  box-shadow: var(--ring);
}

/* ===== Tablas (solo las envueltas en .table-container; no toca la matriz) ===== */
.table-container { border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm); overflow-x: auto; -webkit-overflow-scrolling: touch; }
/* Tablas densas (matriz/liquidación): mismo radio/sombra que el resto, y scroll táctil fluido en mobile */
.matriz-container, .liq-table-container { border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border); -webkit-overflow-scrolling: touch; }
.table-container table { border-collapse: collapse; width: 100%; }
.table-container thead th {
  background: var(--surface-muted);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.table-container tbody tr { transition: background var(--transition); }
.table-container tbody tr:hover { background: var(--surface-muted); }

/* ===== Badges / chips ===== */
.badge, .cert-badge, .tab-badge {
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: .02em;
}

/* ===== Tabs (barra del admin y del panel) ===== */
.tab, .panel-tab { transition: color var(--transition), border-color var(--transition), background var(--transition); }

/* ===== Modales ===== */
.modal, .modal-overlay .modal {
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}

/* ===== Scrollbar sutil (webkit) ===== */
* { scrollbar-width: thin; }
*::-webkit-scrollbar { height: 10px; width: 10px; }
*::-webkit-scrollbar-thumb { background: #cdd1d8; border-radius: var(--radius-pill); border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #b6bbc4; background-clip: content-box; }

/* ============================================================================
   Pulido profesional + efectos sutiles
   ============================================================================ */

/* Entrada suave de las tarjetas al cargar */
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.form-card, .card { animation: fadeUp .5s cubic-bezier(.16,.84,.44,1) both; }
.modo-card { animation: fadeUp .5s cubic-bezier(.16,.84,.44,1) both; }
.modo-card:nth-child(2) { animation-delay: .05s; }
.modo-card:nth-child(3) { animation-delay: .10s; }
.modo-card:nth-child(4) { animation-delay: .15s; }

/* Sombra premium multicapa en las tarjetas principales */
.form-card, .card { box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 14px 34px rgba(16,24,40,.09); }

/* Header con brillo y profundidad sutiles */
.header, .panel-header { position: relative; overflow: hidden; }
.header::after, .panel-header::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 150% at 12% -30%, rgba(255,255,255,.20), transparent 55%),
    radial-gradient(90% 130% at 100% 0%, rgba(0,0,0,.14), transparent 55%);
}
.header > *, .panel-header > * { position: relative; z-index: 1; }

/* Tarjetas de módulo (home): ícono en "chip" + flecha que se desliza en hover */
.modo-card { position: relative; padding-right: 40px; }
.modo-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 46px; height: 46px; border-radius: 12px;
  background: #eef0f3; font-size: 22px; flex-shrink: 0;
  transition: transform var(--transition), background var(--transition);
}
.modo-card:hover .modo-card-icon { transform: scale(1.06); background: #e2e5ea; }
.modo-card::after {
  content: '›'; position: absolute; right: 16px; top: 50%;
  transform: translateY(-50%); color: var(--river-red);
  font-size: 24px; font-weight: 700; line-height: 1; opacity: 0;
  transition: opacity var(--transition), transform var(--transition);
}
.modo-card:hover::after { opacity: 1; transform: translateY(-50%) translateX(4px); }

/* Botones principales: leve degradé para dar volumen */
.submit-btn, .btn-primary, .btn-action.btn-approve, .btn-descargar, .btn-action.btn-info {
  background-image: linear-gradient(180deg, rgba(255,255,255,.10), rgba(0,0,0,.05));
}

/* Respetar la preferencia de menos movimiento */
@media (prefers-reduced-motion: reduce) {
  .form-card, .card, .modo-card { animation: none; }
  .modo-card:hover .modo-card-icon,
  .modo-card:hover::after { transition: none; }
}

/* ============================================================================
   Panel de Ausencias (admin) — tarjetas limpias y responsive.
   Usa variables temáticas (--surface/--text*/--border) para respetar dark mode.
   ============================================================================ */
.aus-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(258px, 1fr)); gap: 16px; }
.aus-card {
  position: relative;
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e6e8ec);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 18px 18px 16px 22px;
  overflow: hidden;
  animation: fadeUp .45s cubic-bezier(.16,.84,.44,1) both;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.aus-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--river-red); }
.aus-card.is-zero::before { background: #cbd0d8; }
.aus-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(200,16,46,.25); }
.aus-nom { font-weight: 700; font-size: 15px; color: var(--text-primary); }
.aus-fecha { font-size: 12px; color: var(--text-secondary); margin: 3px 0 14px; }
.aus-num-row { display: flex; align-items: baseline; gap: 8px; }
.aus-num { font-size: 42px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--river-red); }
.aus-card.is-zero .aus-num { color: #9aa1ac; }
.aus-num-lbl { font-size: 13px; color: var(--text-secondary); font-weight: 600; }
.aus-meta { font-size: 12px; color: var(--text-secondary); margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--border, #e6e8ec); }
.aus-meta strong { color: var(--text-primary); }
.aus-sector { margin-top: 10px; }
.aus-sector > summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--river-red); list-style: none; }
.aus-sector > summary::-webkit-details-marker { display: none; }
.aus-sector > summary::before { content: '▸ '; }
.aus-sector[open] > summary::before { content: '▾ '; }
.aus-sector-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 5px 0; border-top: 1px solid var(--border, #eee); }
.aus-sector-row:first-of-type { margin-top: 6px; }
.aus-sector-num { font-weight: 700; color: var(--river-red); }
.aus-sector-den { color: var(--text-secondary); }
.aus-ver-emp {
  margin-top: 12px; display: inline-block;
  background: var(--river-red-soft, #fdecee); color: var(--river-red);
  border: 1px solid rgba(200,16,46,.2); border-radius: 8px;
  padding: 6px 12px; font-size: 12px; font-weight: 700; cursor: pointer;
  transition: background var(--transition), transform var(--transition);
}
.aus-ver-emp:hover { background: #fbd9de; transform: translateY(-1px); }

@media (max-width: 560px) {
  .aus-grid { grid-template-columns: 1fr; gap: 12px; }
  .aus-num { font-size: 36px; }
}
