/* ==============================================
   REOK · Panel Administración de Clínica
   Tema: ION Software — oscuro, tecnológico
   ============================================== */
:root {
  --bg-primary:   #070b16;
  --bg-secondary: #0c1220;
  --bg-card:      #0f1828;
  --bg-hover:     #141f35;
  --border:       rgba(0,210,255,0.10);
  --border-hover: rgba(0,210,255,0.28);
  --cyan:         #00d2ff;
  --blue:         #3b82f6;
  --purple:       #8b5cf6;
  --green:        #22c55e;
  --yellow:       #eab308;
  --red:          #f87171;
  --text:         #f0f6ff;
  --muted:        #94a3b8;
  --dim:          #4e6280;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body:    'Inter', sans-serif;
  --radius:       12px;
  --transition:   all 0.25s cubic-bezier(0.4,0,0.2,1);
}

*,*::before,*::after { box-sizing:border-box; margin:0; padding:0; font-family:var(--font-body); }

html { scroll-behavior:smooth; }
body { background:var(--bg-primary); color:var(--text); min-height:100vh; -webkit-font-smoothing:antialiased; }

/* ── Layout ──────────────────────────── */
.layout { max-width:1200px; margin:0 auto; padding:24px 16px; }

/* ── Card ────────────────────────────── */
.card {
  background:var(--bg-card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:0 4px 24px rgba(0,0,0,.4);
  padding:20px;
  margin-bottom:16px;
  transition:var(--transition);
}
.card:hover { border-color:var(--border-hover); }

/* ── Author / Beta badge ─────────────── */
.author-badge {
  border:1px solid rgba(0,210,255,.2);
  background:rgba(0,210,255,.05);
  border-radius:10px;
  padding:10px 12px;
  margin:12px 0;
}
.author-badge p { margin:6px 0; font-size:.88rem; color:var(--muted); }
.author-badge a, .author-footer a { color:var(--cyan); font-weight:600; text-decoration:none; }
.author-badge a:hover, .author-footer a:hover { text-decoration:underline; }
.author-footer { border-top:1px solid var(--border); margin-top:20px; padding-top:12px; }
.author-footer p { margin:0; font-size:.88rem; color:var(--muted); }

/* ── Login ───────────────────────────── */
.login-card { max-width:420px; margin:80px auto; }
.brand { text-align:center; margin-bottom:24px; }
.brand h1 { margin:8px 0 4px; font-size:1.6rem; font-family:var(--font-display); color:var(--cyan); font-weight:700; }
.brand-icon { font-size:2.5rem; }

/* ── Form ────────────────────────────── */
.hidden { display:none !important; }

.login-help { margin-top:10px; }
.link-button { background:transparent; color:var(--cyan); padding:0; border:none; text-decoration:underline; font-weight:600; cursor:pointer; font-size:.9rem; }
.link-button:hover { color:var(--blue); }

.recovery-form { margin-top:14px; padding-top:14px; border-top:1px solid var(--border); }
.recovery-actions { display:flex; gap:8px; flex-wrap:wrap; }

label { display:grid; gap:6px; margin-bottom:8px; font-size:.88rem; font-weight:600; color:var(--muted); }

input, select {
  background:var(--bg-secondary);
  border:1px solid var(--border);
  border-radius:8px;
  padding:10px 12px;
  color:var(--text);
  font-family:var(--font-body);
  font-size:.95rem;
  transition:var(--transition);
  width:100%;
}
input:focus, select:focus { outline:none; border-color:var(--cyan); box-shadow:0 0 0 3px rgba(0,210,255,.1); }
input::placeholder { color:var(--dim); }

button {
  background:linear-gradient(135deg,var(--cyan) 0%,var(--blue) 100%);
  color:#000;
  border:none;
  border-radius:8px;
  padding:10px 18px;
  font-size:.92rem;
  font-weight:600;
  cursor:pointer;
  transition:var(--transition);
  font-family:var(--font-body);
}
button:hover { transform:translateY(-1px); box-shadow:0 4px 16px rgba(0,210,255,.3); }
button:active { transform:scale(.98); }

button.secondary {
  background:var(--bg-hover);
  color:var(--text);
  border:1px solid var(--border-hover);
  box-shadow:none;
}
button.secondary:hover { background:rgba(0,210,255,.08); border-color:var(--cyan); color:var(--cyan); transform:translateY(-1px); box-shadow:none; }

/* ── Panel header ────────────────────── */
.panel-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 0; }

/* ── Tabs ────────────────────────────── */
.tabs-nav { display:flex; gap:8px; flex-wrap:wrap; margin:14px 0 18px; }
.tab-btn {
  background:var(--bg-hover);
  color:var(--muted);
  border:1px solid var(--border);
  font-weight:600;
  padding:8px 18px;
  border-radius:8px;
  cursor:pointer;
  font-family:var(--font-body);
  transition:var(--transition);
  font-size:.88rem;
}
.tab-btn.active {
  background:linear-gradient(135deg,var(--cyan) 0%,var(--blue) 100%);
  color:#000;
  border-color:transparent;
  box-shadow:0 2px 12px rgba(0,210,255,.25);
}
.tab-btn:not(.active):hover { border-color:var(--border-hover); color:var(--cyan); }
.tab-panel.tab-hidden { display:none; }

/* ── Horarios tab ────────────────────── */
.horario-form { flex-wrap:wrap; gap:10px; }
.horario-nombre { min-width:180px; }
.horario-label { display:flex; align-items:center; gap:6px; font-weight:400; }
.horario-tolerancia { width:65px; }
.horario-select { min-width:180px; }
.horario-dias { border:1px solid var(--border,#334); border-radius:6px; padding:6px 12px; display:flex; gap:10px; flex-wrap:wrap; }
.horario-dias-legend { font-size:.8rem; color:var(--muted); }
.horario-dias-col { letter-spacing:2px; }
.horarios-lista-title { margin-top:24px; }
.horarios-sep { margin:24px 0; }
.horario-ok { color:#22c55e; font-size:.9rem; margin-top:6px; }
.horario-btn-sm { padding:4px 10px; font-size:.8rem; }
.horario-btn-danger { color:#ef4444; }
.horario-partido-toggle { font-weight:600; }
.horario-partido-tramo { display:contents; }

/* ── Grid ────────────────────────────── */
.grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.inline-form { display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin-bottom:10px; }
.inline-form input, .inline-form select { flex:1 1 160px; min-width:0; }
.inline-form button, .inline-form a { flex:0 0 auto; }

/* ── System health ───────────────────── */
.system-health-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:12px; }
.health-box { border:1px solid var(--border); border-radius:10px; padding:12px; background:var(--bg-secondary); }

/* ── Table ───────────────────────────── */
table { width:100%; border-collapse:collapse; font-size:.9rem; }
th { text-align:left; padding:10px 12px; background:rgba(0,210,255,.04); border-bottom:1px solid var(--border-hover); color:var(--muted); font-weight:600; font-size:.78rem; text-transform:uppercase; letter-spacing:.06em; font-family:var(--font-display); }
td { padding:10px 12px; border-bottom:1px solid var(--border); vertical-align:middle; }
tr:last-child td { border-bottom:none; }
tr:hover td { background:rgba(0,210,255,.03); }

/* ── Buttons extra ───────────────────── */
.btn-accion { border:none; border-radius:6px; padding:4px 10px; font-size:.82rem; font-weight:600; cursor:pointer; transition:opacity .15s; }
.btn-accion:hover { opacity:.82; }
.btn-editar { background:rgba(59,130,246,.15); color:var(--blue); border:1px solid rgba(59,130,246,.3); }
.btn-pin    { background:rgba(234,179,8,.12); color:var(--yellow); border:1px solid rgba(234,179,8,.3); }

/* ── Misc ────────────────────────────── */
.muted { color:var(--muted); }
.hint  { font-weight:400; color:var(--muted); font-size:.82rem; }
.form-info { background:rgba(0,210,255,.05); border:1px solid rgba(0,210,255,.2); border-radius:8px; padding:10px 14px; margin-bottom:16px; font-size:.88rem; color:var(--muted); }

/* ── Dialog ──────────────────────────── */
dialog {
  background:var(--bg-card);
  border:1px solid var(--border-hover);
  border-radius:16px;
  padding:28px 32px;
  min-width:340px;
  max-width:480px;
  width:90%;
  box-shadow:0 24px 64px rgba(0,0,0,.6),0 0 40px rgba(0,210,255,.06);
  color:var(--text);
}
dialog::backdrop { background:rgba(0,0,0,.65); backdrop-filter:blur(8px); }
dialog h3 { margin:0 0 16px; font-size:1.1rem; font-family:var(--font-display); color:var(--cyan); }

.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:16px; }
.form-grid label, dialog > form > label { display:flex; flex-direction:column; gap:4px; font-size:.85rem; font-weight:600; color:var(--muted); }
.form-grid input[type="text"], .form-grid input[type="password"],
dialog input[type="password"], dialog input[type="text"] { padding:8px 10px; width:100%; }
.check-label { grid-column:1 / -1; flex-direction:row !important; align-items:center; gap:8px !important; }
.form-error { color:var(--red); background:rgba(248,113,113,.08); border:1px solid rgba(248,113,113,.25); border-radius:6px; padding:8px 10px; font-size:.85rem; margin-bottom:12px; }
.form-error.hidden { display:none; }

.modal-actions { display:flex; gap:10px; justify-content:flex-end; margin-top:12px; }
.btn-primary   { background:linear-gradient(135deg,var(--cyan),var(--blue)); color:#000; border:none; border-radius:7px; padding:9px 20px; font-weight:600; cursor:pointer; font-family:var(--font-body); transition:var(--transition); }
.btn-primary:hover { box-shadow:0 4px 16px rgba(0,210,255,.3); transform:translateY(-1px); }
.btn-secondary { background:var(--bg-hover); color:var(--text); border:1px solid var(--border-hover); border-radius:7px; padding:9px 20px; font-weight:600; cursor:pointer; font-family:var(--font-body); transition:var(--transition); }
.btn-secondary:hover { border-color:var(--cyan); color:var(--cyan); }

/* ── Backups table download btn ──────── */
.btn { display:inline-flex; align-items:center; padding:5px 12px; border-radius:6px; font-size:.82rem; font-weight:600; cursor:pointer; text-decoration:none; transition:var(--transition); }
.btn.secondary { background:var(--bg-hover); color:var(--muted); border:1px solid var(--border); }
.btn.secondary:hover { border-color:var(--cyan); color:var(--cyan); }

/* ── Toast ───────────────────────────── */
.toast { position:fixed; right:16px; bottom:16px; background:var(--bg-card); border:1px solid var(--border-hover); color:var(--text); padding:12px 16px; border-radius:10px; font-size:.9rem; z-index:9999; box-shadow:0 8px 32px rgba(0,0,0,.5); }
.toast.hidden { display:none; }

/* ── 2FA ─────────────────────────────── */
.otp-info { text-align:center; padding:12px 0 8px; }
.otp-icon { font-size:2rem; }
.otp-info p { color:var(--muted); margin:6px 0 16px; font-size:.9rem; }
#otpCode { letter-spacing:.3em; font-size:1.4rem; text-align:center; font-weight:700; font-family:var(--font-display); }
.tfa-status { display:flex; align-items:center; gap:14px; padding:14px 0; }
.qr-container { display:flex; justify-content:center; margin:16px 0; }
.qr-container img { border:4px solid var(--border-hover); border-radius:12px; padding:8px; background:var(--bg-secondary); }

/* ── Responsive ──────────────────────── */
@media (max-width:900px) {
  .grid { grid-template-columns:1fr; }
  .tabs-nav { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); }
}

/* ── Ausencias ───────────────────────── */
.aus-badge { display:inline-block; font-size:.75rem; font-weight:700; padding:2px 9px; border-radius:20px; text-transform:uppercase; letter-spacing:.04em; }
.aus-badge.PENDIENTE  { background:rgba(234,179,8,.15); color:#fbbf24; border:1px solid rgba(234,179,8,.35); }
.aus-badge.APROBADA   { background:rgba(34,197,94,.1); color:#4ade80; border:1px solid rgba(34,197,94,.3); }
.aus-badge.RECHAZADA  { background:rgba(248,113,113,.1); color:#f87171; border:1px solid rgba(248,113,113,.3); }
.origen-badge { display:inline-block; font-size:.72rem; font-weight:700; padding:2px 8px; border-radius:20px; text-transform:uppercase; letter-spacing:.04em; }
.origen-tt    { background:rgba(99,102,241,.15); color:#818cf8; border:1px solid rgba(99,102,241,.35); }
.origen-qr    { background:rgba(34,197,94,.1);   color:#4ade80; border:1px solid rgba(34,197,94,.3); }
.origen-movil { background:rgba(148,163,184,.1);  color:#94a3b8; border:1px solid rgba(148,163,184,.3); }

/* Calendario ausencias */
.aus-calendar { background:var(--bg-card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; }
.aus-cal-header { display:grid; grid-template-columns:repeat(7,1fr); }
.aus-cal-dow { text-align:center; padding:8px 4px; font-size:.75rem; font-weight:700; color:var(--muted); text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid var(--border); }
.aus-cal-grid { display:grid; grid-template-columns:repeat(7,1fr); }
.aus-cal-day { min-height:64px; border-bottom:1px solid var(--border); border-right:1px solid var(--border); padding:5px 6px; position:relative; }
.aus-cal-day:nth-child(7n) { border-right:none; }
.aus-cal-day.other-month { opacity:.3; }
.aus-cal-day.today { background:rgba(0,210,255,.06); }
.aus-day-num { font-size:.78rem; color:var(--muted); font-weight:600; }
.aus-day-chip { font-size:.7rem; font-weight:600; border-radius:4px; padding:2px 5px; margin-top:3px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; cursor:default; }
.aus-day-chip.APROBADA  { background:rgba(34,197,94,.2); color:#4ade80; }
.aus-day-chip.PENDIENTE { background:rgba(234,179,8,.18); color:#fbbf24; }
.aus-day-chip.RECHAZADA { background:rgba(248,113,113,.15); color:#f87171; }

/* ── Modal enlaces ── */
#modalEnlaces { padding: 20px 24px; min-width: min(500px, 95vw); }
.enlace-row { display: grid; grid-template-columns: 140px 1fr auto; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: .88rem; }
.enlace-row:last-child { border-bottom: none; }
.enlace-row span { font-weight: 600; white-space: nowrap; }
.enlace-row a { color: var(--accent, #38bdf8); word-break: break-all; font-size: .8rem; }
.enlace-row .btn-copy-enlace { white-space: nowrap; }
