/* ============================================================
   CAMPAMENTOS HÍPICA — Admin & Monitor CSS
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --brand:        #1f6b3e;
  --brand-dark:   #14472a;
  --brand-light:  #27a354;
  --brand-50:     #f0fdf4;
  --brand-100:    #dcfce7;

  --sidebar-bg:   #111f18;
  --sidebar-w:    220px;

  --ok-bg:        #dcfce7; --ok-text:    #166534; --ok-border:  #bbf7d0;
  --warn-bg:      #fef9c3; --warn-text:  #854d0e; --warn-border:#fef08a;
  --error-bg:     #fee2e2; --error-text: #991b1b; --error-border:#fecaca;

  --text:         #111827;
  --text-muted:   #6b7280;
  --border:       #e5e7eb;
  --bg:           #f3f4f6;
  --white:        #ffffff;
  --radius:       8px;
  --radius-sm:    4px;
  --shadow:       0 1px 3px rgb(0 0 0/.1);
  --shadow-md:    0 4px 6px -1px rgb(0 0 0/.1);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }

code { font-family: ui-monospace, monospace; background: #f1f5f9; padding: 1px 5px; border-radius: 3px; font-size: .85em; }

/* ── Layout — Admin ────────────────────────────────────────── */
.layout-admin,
.layout-monitor {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--sidebar-bg);
  color: #c9d3c0;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 1.25rem 1.25rem 1rem;
  font-weight: 700;
  font-size: .95rem;
  color: #fff;
  letter-spacing: .02em;
  border-bottom: 1px solid rgba(255 255 255 / .08);
}

.sidebar ul {
  list-style: none;
  padding: .5rem 0;
  flex: 1;
}

.sidebar ul li a {
  display: block;
  padding: .55rem 1.25rem;
  color: #a7bca0;
  font-size: .9rem;
  border-radius: 0;
  transition: background .15s, color .15s;
}

.sidebar ul li a:hover {
  background: rgba(255 255 255 / .07);
  color: #fff;
  text-decoration: none;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255 255 255 / .08);
  font-size: .82rem;
  color: #7a9473;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.sidebar-footer form button {
  background: rgba(255 255 255 / .08);
  color: #a7bca0;
  border: none;
  padding: .35rem .8rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: .82rem;
  transition: background .15s;
}

.sidebar-footer form button:hover { background: rgba(255 255 255 / .14); color: #fff; }

.main-content {
  padding: 2rem;
  max-width: 1200px;
  min-width: 0;
}

/* ── Layout — Login ────────────────────────────────────────── */
.layout-login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sidebar-bg);
}

.login-box {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-md);
}

.login-box h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: .15rem;
}

.login-box h2 {
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 1.5rem;
}

.login-box label {
  display: block;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: .3rem;
  margin-top: 1rem;
}

.login-box input {
  width: 100%;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  outline: none;
  transition: border-color .15s;
}

.login-box input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgb(31 107 62 / .12); }

.login-box button[type="submit"] {
  margin-top: 1.5rem;
  width: 100%;
  background: var(--brand);
  color: white;
  border: none;
  padding: .7rem;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}

.login-box button[type="submit"]:hover { background: var(--brand-dark); }

/* ── Page header ───────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.page-header h1 {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex-wrap: wrap;
}

.page-header-actions {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* ── Section cards ─────────────────────────────────────────── */
.section-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow);
}

.section-card h2 {
  margin-bottom: 1rem;
  padding-bottom: .6rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: .5rem;
}

.section-highlight { border-left: 4px solid var(--brand); }
.section-alerta    { border-left: 4px solid #f59e0b; }

/* ── Alerts ────────────────────────────────────────────────── */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .9rem;
  font-weight: 500;
}

.alert-ok    { background: var(--ok-bg);    color: var(--ok-text);    border: 1px solid var(--ok-border); }
.alert-error { background: var(--error-bg); color: var(--error-text); border: 1px solid var(--error-border); }

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .55rem;
  border-radius: 99px;
  font-size: .75rem;
  font-weight: 600;
  background: #f1f5f9;
  color: #475569;
  white-space: nowrap;
}

.badge-ok    { background: var(--ok-bg);    color: var(--ok-text); }
.badge-warn  { background: var(--warn-bg);  color: var(--warn-text); }
.badge-error { background: var(--error-bg); color: var(--error-text); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  padding: .45rem .9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--white);
  color: var(--text);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s;
  line-height: 1.4;
  white-space: nowrap;
}

.btn:hover { background: var(--bg); border-color: #d1d5db; text-decoration: none; }

.btn-primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }

.btn-ok {
  background: #16a34a;
  color: white;
  border-color: #16a34a;
}
.btn-ok:hover { background: #166534; }

.btn-danger {
  background: #dc2626;
  color: white;
  border-color: #dc2626;
}
.btn-danger:hover { background: #b91c1c; }

.btn-sm { padding: .3rem .65rem; font-size: .8rem; }

/* ── Tables ────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.table th,
.table td {
  padding: .65rem .85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.table th {
  font-weight: 600;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  background: var(--bg);
  white-space: nowrap;
}

.table tbody tr:hover { background: #fafafa; }
.table tbody tr:last-child td { border-bottom: none; }

.table-compact th,
.table-compact td { padding: .45rem .7rem; }

.table-scroll { overflow-x: auto; }

.table-count {
  font-size: .82rem;
  color: var(--text-muted);
  margin: .5rem 0 1rem;
}

.actions { white-space: nowrap; display: flex; gap: .35rem; flex-wrap: wrap; }

.fila-alerta { background: #fffbeb !important; }
.celda-alerta { color: #92400e; font-weight: 500; }

.nombre-participante { font-weight: 600; }
.text-muted { color: var(--text-muted); font-style: normal; }
.text-error { color: var(--error-text); }

/* ── Forms ─────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
}

.field label,
.field > label {
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}

.field input,
.field select,
.field textarea {
  padding: .5rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  background: var(--white);
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgb(31 107 62 / .1);
}

.field-row {
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: .75rem;
}

.field-row .field { flex: 1; min-width: 140px; }
.field-wide { flex: 2 !important; }
.field-action { flex: 0 0 auto !important; }
.field-readonly input { background: var(--bg); color: var(--text-muted); }

.form-filtros { margin-bottom: 1.25rem; }

.form-inline .field-row { margin-bottom: 0; }
.form-inline { display: flex; flex-direction: column; gap: .75rem; }

.form-config { display: flex; flex-direction: column; gap: .75rem; margin-top: .75rem; }

.hint  { font-size: .8rem; color: var(--text-muted); line-height: 1.5; }
.meta  { font-size: .78rem; color: var(--text-muted); margin-top: .5rem; }

/* ── Detail list ───────────────────────────────────────────── */
.detail-list { display: grid; grid-template-columns: 160px 1fr; gap: .4rem .75rem; font-size: .9rem; }
.detail-list dt { font-weight: 600; color: var(--text-muted); font-size: .82rem; }
.detail-list-row { display: flex; gap: 2rem; flex-wrap: wrap; }
.detail-list-row dt { font-weight: 600; font-size: .82rem; color: var(--text-muted); }
.detail-list-row dd { font-size: 1rem; font-weight: 600; }

/* ── Expandable (details/summary) ──────────────────────────── */
.expandable {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
}

.expandable > summary {
  padding: .7rem 1rem;
  cursor: pointer;
  font-weight: 600;
  font-size: .9rem;
  color: var(--brand);
  list-style: none;
  user-select: none;
}

.expandable > summary:hover { background: var(--brand-50); border-radius: var(--radius-sm); }
.expandable[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius-sm) var(--radius-sm) 0 0; }

.expandable > :not(summary) { padding: 1rem; }

/* ── Stats dashboard ───────────────────────────────────────── */
.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: .5rem;
}

.stat-block {
  flex: 1;
  min-width: 110px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .85rem 1rem;
  text-align: center;
}

.stat-label   { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: .25rem; }
.stat-value   { font-size: 1.75rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-value-lg{ font-size: 2.25rem; }
.stat-value-md{ font-size: 1.3rem; }
.stat-sub     { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; }

.stat-ok    { background: var(--ok-bg);    border-color: var(--ok-border); }
.stat-ok .stat-value, .stat-ok .stat-value-md { color: var(--ok-text); }
.stat-warn  { background: var(--warn-bg);  border-color: var(--warn-border); }
.stat-warn .stat-value { color: var(--warn-text); }
.stat-error { background: var(--error-bg); border-color: var(--error-border); }
.stat-error .stat-value { color: var(--error-text); }

.stat-pendiente { font-size: .88rem; color: var(--warn-text); margin-top: .5rem; font-weight: 500; }

/* ── Config grid ───────────────────────────────────────────── */
.config-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.config-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .15s, border-color .15s;
  display: block;
}

.config-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand); text-decoration: none; }
.config-card h2 { font-size: 1rem; color: var(--brand); margin-bottom: .4rem; border: none; padding: 0; }
.config-card p  { font-size: .82rem; color: var(--text-muted); margin: 0; }

/* ── Config nav (partial) ──────────────────────────────────── */
.config-nav {
  display: flex;
  gap: .3rem;
  flex-wrap: wrap;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
  padding-bottom: .6rem;
}
.config-nav a {
  display: inline-block;
  padding: .3rem .85rem;
  font-size: .82rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-muted);
  background: var(--white);
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.config-nav a:hover {
  background: var(--brand-50);
  border-color: var(--brand-light);
  color: var(--brand);
  text-decoration: none;
}
.config-nav a.active {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
}

/* ── Monitor — Semana cards ────────────────────────────────── */
.semanas-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .75rem;
}

.semana-card {
  display: block;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow .15s, border-color .15s, transform .1s;
}

.semana-card:hover { box-shadow: var(--shadow-md); border-color: var(--brand); transform: translateY(-1px); text-decoration: none; }
.semana-en-curso   { border-color: var(--brand); border-width: 2px; background: var(--brand-50); }
.semana-pasada     { opacity: .6; }

.semana-card-nombre { font-weight: 700; font-size: .95rem; margin-bottom: .3rem; }
.semana-card-fechas { font-size: .8rem; color: var(--text-muted); }
.semana-card-badge  {
  display: inline-block;
  margin-top: .5rem;
  padding: .15rem .5rem;
  border-radius: 99px;
  font-size: .72rem;
  font-weight: 700;
  background: var(--brand);
  color: white;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.semana-fechas { font-size: .82rem; color: var(--text-muted); font-weight: 400; }

/* ── Participantes listado ─────────────────────────────────── */
.participante-bloque {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: .75rem;
}

.participante-bloque h3 { font-size: .95rem; margin-bottom: .6rem; color: var(--brand); }

.leyenda { margin-top: 1rem; font-size: .78rem; color: var(--text-muted); }
.fila-alerta-muestra {
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 3px;
  padding: .15rem .5rem;
  display: inline-block;
}

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .layout-admin,
  .layout-monitor { grid-template-columns: 1fr; }

  .sidebar { display: none; }
  .main-content { padding: 1rem; }

  .stats-row { gap: .5rem; }
  .stat-block { min-width: 80px; }

  .config-grid { grid-template-columns: 1fr 1fr; }
}
