/* =========================================================================
   Reservas Sala de Juntas — Procables · Hoja de estilos
   Diseño limpio, moderno y accesible. Sin dependencias externas.
   ========================================================================= */
:root {
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --primary-050: #eff4ff;
  --accent: #ea580c;          /* cobre Procables (acento puntual) */
  --bg: #eef2f7;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --radius: 14px;
  --radius-sm: 9px;
  --ring: 0 0 0 3px rgba(37, 111, 235, 0.28);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 12px -2px rgba(15, 23, 42, 0.10), 0 2px 6px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 40px -12px rgba(15, 23, 42, 0.28);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-600); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--text); }

/* ---------- Navegación ---------- */
.nav {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(6px);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.nav .brand {
  font-weight: 800; font-size: 16px; color: var(--text);
  display: flex; align-items: center; gap: 9px; letter-spacing: -0.01em;
}
.nav .brand::before {
  content: ""; width: 26px; height: 26px; border-radius: 7px; flex: none;
  background:
    linear-gradient(135deg, var(--primary), var(--primary-700));
  box-shadow: inset 0 0 0 2px rgba(255,255,255,.25);
}
.nav .brand span { color: var(--primary-600); }
.nav .links { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav .links > a {
  font-size: 14px; color: var(--muted); font-weight: 600;
  padding: 7px 12px; border-radius: 8px; transition: background .15s, color .15s;
}
.nav .links > a:hover { background: var(--primary-050); color: var(--primary-700); text-decoration: none; }
.userbox {
  color: var(--muted); display: flex; gap: 10px; align-items: center;
  font-size: 14px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--border);
}
.userbox #userName { font-weight: 600; color: var(--text); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
}
.badge {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  background: var(--primary-050); color: var(--primary-700); font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase;
}
.badge.admin { background: #fef3c7; color: #92400e; }

/* ---------- Layout ---------- */
.container { max-width: 1120px; margin: 26px auto; padding: 0 18px; }
.center-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(37,111,235,.18), transparent 60%),
    linear-gradient(160deg, #eef3fb 0%, #e7edf6 100%);
}
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 22px 24px;
}
.card + .card { margin-top: 20px; }
.card h2 { margin: 0 0 4px; font-size: 17px; letter-spacing: -0.01em; }
.card h2 + label, .card h2 + .checkbox-row { margin-top: 14px; }
.card h3 { font-size: 14px; }

/* Tarjeta de acceso (login / registro) */
.auth-card {
  width: 100%; max-width: 430px; padding: 30px 30px 26px;
  border-radius: 18px; box-shadow: var(--shadow-lg); border: 1px solid #e7ecf3;
}
.brand-mark {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-700));
  box-shadow: 0 10px 22px -8px rgba(37, 99, 235, .7), inset 0 0 0 1px rgba(255,255,255,.2);
}
.brand-mark svg { width: 30px; height: 30px; }
.auth-title { text-align: center; margin: 0; font-size: 21px; letter-spacing: -0.02em; }
.auth-sub { text-align: center; color: var(--muted); margin: 2px 0 6px; font-size: 13px; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------- Formularios ---------- */
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; color: #334155; }
input, select, textarea {
  width: 100%; padding: 10px 12px; font-size: 14px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--text); font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
input::placeholder, textarea::placeholder { color: #94a3b8; }
input:hover, select:hover, textarea:hover { border-color: #94a3b8; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: var(--ring);
}
textarea { resize: vertical; min-height: 70px; }
.help { font-size: 12px; color: var(--muted); margin-top: 5px; }
.inline { display: flex; gap: 10px; align-items: center; }
.inline input[type="checkbox"] { width: auto; }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; margin: 11px 0; }
.checkbox-row input[type="checkbox"] { width: auto; margin-top: 2px; }
.checkbox-row label { margin: 0; font-weight: 500; color: var(--text); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }

/* Lista de invitados (reemplaza al <select multiple>) */
.check-list {
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  max-height: 168px; overflow-y: auto; background: #fff; padding: 4px;
}
.check-list:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.check-item {
  display: flex; align-items: center; gap: 10px; margin: 0;
  padding: 8px 10px; border-radius: 7px; cursor: pointer; font-weight: 500; font-size: 14px;
}
.check-item:hover { background: var(--primary-050); }
.check-item input { width: auto; }
.check-item .who { display: flex; flex-direction: column; line-height: 1.25; }
.check-item .who small { color: var(--muted); font-weight: 400; }
.check-empty { padding: 12px; color: var(--muted); font-size: 13px; text-align: center; }

/* ---------- Botones ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 10px 18px; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--radius-sm);
  background: linear-gradient(180deg, var(--primary), var(--primary-600)); color: #fff;
  box-shadow: var(--shadow-sm); transition: filter .15s, transform .05s, box-shadow .15s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--ring); }
.btn:disabled { opacity: .65; cursor: not-allowed; filter: none; }
.btn.secondary { background: #fff; color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.btn.secondary:hover { background: #f8fafc; filter: none; }
.btn.danger { background: linear-gradient(180deg, #ef4444, var(--danger)); }
.btn.small { padding: 6px 12px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; align-items: center; }
/* Spinner de carga */
.btn[data-loading="true"] { color: transparent !important; pointer-events: none; }
.btn[data-loading="true"]::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .5); border-top-color: #fff; animation: spin .6s linear infinite;
}
.btn.secondary[data-loading="true"]::after { border-color: rgba(37,99,235,.35); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Mensajes ---------- */
.msg {
  padding: 11px 14px 11px 40px; border-radius: var(--radius-sm); font-size: 13px;
  margin: 14px 0; display: none; position: relative; border: 1px solid transparent;
}
.msg.show { display: block; }
.msg::before {
  position: absolute; left: 14px; top: 11px; font-weight: 700; font-size: 14px; line-height: 1.2;
}
.msg.error { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.msg.error::before { content: "!"; color: var(--danger); }
.msg.ok { background: #f0fdf4; color: #15803d; border-color: #bbf7d0; }
.msg.ok::before { content: "\2713"; color: var(--ok); }
.msg.info { background: var(--primary-050); color: var(--primary-700); border-color: #c7dbfe; }
.msg.info::before { content: "i"; color: var(--primary-600); font-style: italic; }
.msg ul { margin: 6px 0 0 4px; padding-left: 18px; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
table.data thead th { background: #f8fafc; color: var(--muted); font-weight: 700; white-space: nowrap; position: sticky; top: 0; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover td { background: #f8fafc; }
.table-empty { text-align: center; color: var(--muted); padding: 22px !important; }
.pill { display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 700; text-transform: capitalize; }
.pill.activo { background: #dcfce7; color: #15803d; }
.pill.pendiente { background: #fef3c7; color: #92400e; }
.pill.suspendido { background: #fee2e2; color: #b91c1c; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; flex-wrap: wrap; }
.tab {
  padding: 10px 15px; cursor: pointer; font-size: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-700); border-bottom-color: var(--primary); }
.tab-panel { display: none; animation: fadeIn .2s ease; }
.tab-panel.active { display: block; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, .5); display: none;
  align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto;
  backdrop-filter: blur(2px);
}
.modal-backdrop.show { display: flex; animation: fadeIn .18s ease; }
.modal {
  background: #fff; border-radius: var(--radius); width: 100%; max-width: 580px;
  padding: 24px 26px; box-shadow: var(--shadow-lg); animation: popIn .2s cubic-bezier(.2,.8,.3,1);
}
.modal h3 { margin: 0 0 2px; font-size: 18px; letter-spacing: -0.01em; }
.modal h4 { margin: 16px 0 2px; font-size: 14px; }
.modal-close {
  float: right; cursor: pointer; color: var(--muted); font-size: 22px; line-height: 1;
  border: none; background: none; width: 32px; height: 32px; border-radius: 8px; margin: -6px -8px 0 0;
}
.modal-close:hover { background: #f1f5f9; color: var(--text); }

/* ---------- Calendario ---------- */
#calendar {
  background: #fff; padding: 14px; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.fc .fc-button-primary {
  background: var(--primary); border-color: var(--primary); font-weight: 600; text-transform: capitalize;
}
.fc .fc-button-primary:hover { background: var(--primary-600); border-color: var(--primary-600); }
.fc .fc-button-primary:not(:disabled).fc-button-active { background: var(--primary-700); border-color: var(--primary-700); }
.fc .fc-toolbar-title { font-size: 18px; font-weight: 700; }
.fc .fc-event { border-radius: 6px; padding: 1px 3px; font-size: 12px; cursor: pointer; }
.fc .fc-timegrid-now-indicator-line { border-color: var(--accent); }
.legend { font-size: 12.5px; color: var(--muted); margin: 10px 2px 0; display: flex; gap: 16px; flex-wrap: wrap; }
.legend .dot { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot::before { content: ""; width: 11px; height: 11px; border-radius: 3px; background: var(--primary); }
.legend .dot.otros::before { background: var(--muted); }

/* Barra de acciones sobre el calendario */
.toolbar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }

/* ---------- Utilidades ---------- */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 18px; }
.right { text-align: right; }
.qr { text-align: center; }
.qr img { width: 184px; height: 184px; border: 1px solid var(--border); border-radius: 10px; padding: 6px; background: #fff; }
.pw-rules { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px; }
.pw-rules li { font-size: 12px; color: var(--muted); padding-left: 20px; position: relative; }
.pw-rules li::before { content: "\25CB"; position: absolute; left: 2px; color: #cbd5e1; }
.pw-rules li.valid { color: var(--ok); }
.pw-rules li.valid::before { content: "\2713"; color: var(--ok); }
.divider { height: 1px; background: var(--border); margin: 20px 0; border: 0; }
code { background: #f1f5f9; padding: 2px 6px; border-radius: 5px; font-size: 12px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
  .nav { padding: 10px 14px; }
  .userbox { border-left: none; padding-left: 0; }
  .container { margin: 18px auto; }
  .modal { padding: 20px 18px; }
}
