/* =========================================================
   Synexa Reservas — Design System
   Archivo: /app/reservas/baseReservas.css
   Versión: synexa-reservas-ui-1.0.0
   ========================================================= */

/* ---------- Variables ---------- */

:root {
  --sx-primary: #17213e;
  --sx-primary-2: #202331;
  --sx-primary-soft: #eef2ff;

  --sx-accent: #2563eb;
  --sx-accent-hover: #1d4ed8;
  --sx-accent-soft: #eff6ff;

  --sx-bg: #f4f6fb;
  --sx-bg-2: #edf1f7;
  --sx-surface: #ffffff;
  --sx-surface-soft: #f8fafc;

  --sx-text: #151827;
  --sx-text-soft: #334155;
  --sx-muted: #64748b;
  --sx-muted-2: #94a3b8;

  --sx-border: #e2e8f0;
  --sx-border-strong: #cbd5e1;

  --sx-success-bg: #dcfce7;
  --sx-success-text: #166534;
  --sx-warning-bg: #fef3c7;
  --sx-warning-text: #92400e;
  --sx-danger-bg: #fee2e2;
  --sx-danger-text: #991b1b;
  --sx-neutral-bg: #f1f5f9;
  --sx-neutral-text: #475569;

  --sx-shadow-sm: 0 4px 12px rgba(15, 23, 42, 0.05);
  --sx-shadow-md: 0 12px 32px rgba(15, 23, 42, 0.08);
  --sx-shadow-lg: 0 24px 80px rgba(15, 23, 42, 0.20);

  --sx-radius-xs: 10px;
  --sx-radius-sm: 14px;
  --sx-radius-md: 18px;
  --sx-radius-lg: 24px;
  --sx-radius-xl: 32px;
  --sx-radius-pill: 999px;

  --sx-max: 1120px;

  --color-primary: var(--sx-accent);
  --color-primary-hover: var(--sx-accent-hover);
  --color-accent: var(--sx-primary);
  --color-bg: var(--sx-bg);
  --color-surface: var(--sx-surface);
  --color-text: var(--sx-text);
  --color-muted: var(--sx-muted);
  --color-border: var(--sx-border);
  --shadow-md: var(--sx-shadow-md);
  --shadow-lg: var(--sx-shadow-lg);
}

/* ---------- Reset ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  background:
    radial-gradient(circle at 8% 0%, rgba(23, 33, 62, 0.10), transparent 28%),
    radial-gradient(circle at 92% 8%, rgba(37, 99, 235, 0.10), transparent 26%),
    linear-gradient(180deg, var(--sx-bg) 0%, var(--sx-bg-2) 100%);
  color: var(--sx-text);
  text-rendering: optimizeLegibility;
}

body::selection {
  background: rgba(37, 99, 235, 0.18);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
}

/* ---------- Layout base ---------- */

.container {
  width: 100%;
  max-width: var(--sx-max);
  margin: 0 auto;
  padding: 22px 16px;
}

.section {
  margin-bottom: 24px;
}

.dashboard-page,
.admin-page,
.page-shell {
  min-height: 100vh;
  padding: 22px 16px 48px;
}

.dashboard-shell,
.admin-shell {
  width: 100%;
  max-width: var(--sx-max);
  margin: 0 auto;
}

.grid-2,
.form-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.grid-3,
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.form-row-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-row-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.full-span {
  grid-column: 1 / -1;
}

.panel-stack,
.admin-list,
.visits-list {
  display: grid;
  gap: 12px;
}

/* ---------- Header ---------- */

.site-header {
  background: transparent;
  border: 0;
}

.navbar {
  width: 100%;
  max-width: var(--sx-max);
  margin: 0 auto;
  padding: 20px 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand,
.brand-inline,
.dashboard-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-logo,
.dashboard-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  border-radius: 14px;
}

.brand-kicker,
.dashboard-kicker {
  margin: 0;
  font-size: 11px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--sx-muted);
}

.brand-title-small {
  margin-top: 6px;
  font-size: 18px;
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--sx-text);
}

.nav-cta,
.page-actions,
.dashboard-actions,
.section-actions,
.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-actions {
  margin-top: 14px;
}

/* ---------- Cards ---------- */

.card {
  position: relative;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(226, 232, 240, 0.92);
  border-radius: var(--sx-radius-lg);
  padding: 24px;
  box-shadow: var(--sx-shadow-md);
  backdrop-filter: blur(14px);
}

.mini-card,
.visit-item,
.admin-row,
.result-card,
.form-card {
  background: var(--sx-surface);
  border: 1px solid var(--sx-border);
  border-radius: var(--sx-radius-md);
  padding: 16px;
  box-shadow: var(--sx-shadow-sm);
}

.mini-card-title {
  margin: 0 0 6px;
  font-size: 17px;
  line-height: 1.25;
  font-weight: 850;
  letter-spacing: -0.03em;
  color: var(--sx-text);
}

.mini-card-subtitle {
  margin: 0;
  color: var(--sx-muted);
  font-size: 14px;
}

.note,
.empty-state {
  background: var(--sx-surface-soft);
  border: 1px solid var(--sx-border);
  border-radius: var(--sx-radius-md);
  padding: 16px;
}

.empty-state {
  text-align: center;
  padding: 34px 22px;
}

.empty-state h3 {
  margin: 0 0 8px;
}

.empty-state p {
  color: var(--sx-muted);
  margin-bottom: 18px;
}

/* ---------- Tipografía ---------- */

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.04em;
}

.small {
  font-size: 14px;
}

.muted {
  color: var(--sx-muted);
}

.strong {
  font-weight: 850;
}

.kicker {
  margin: 0 0 10px;
  color: var(--sx-accent);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.lead {
  color: var(--sx-muted);
  line-height: 1.55;
}

.section-head {
  margin-bottom: 16px;
}

.section-title {
  margin: 0 0 6px;
  font-size: 22px;
  line-height: 1.15;
  font-weight: 850;
  color: var(--sx-text);
}

.section-subtitle {
  margin: 0;
  max-width: 680px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--sx-muted);
}

/* ---------- Hero ---------- */

.dashboard-hero {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  margin-bottom: 22px;
  overflow: hidden;
}

.dashboard-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(135deg, rgba(23, 33, 62, 0.045), transparent 48%),
    radial-gradient(circle at 92% 18%, rgba(37, 99, 235, 0.10), transparent 30%);
  pointer-events: none;
}

.dashboard-hero-left,
.dashboard-hero-right {
  position: relative;
  z-index: 1;
}

.dashboard-hero-left {
  flex: 1;
  min-width: 0;
}

.hero-label {
  margin: 0 0 10px;
  color: var(--sx-accent);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.11em;
}

.hero-title,
.dashboard-title,
.page-header h1,
.auth-title {
  margin: 0 0 8px;
  font-size: clamp(26px, 4vw, 36px);
  line-height: 1.02;
  font-weight: 900;
  letter-spacing: -0.055em;
  color: var(--sx-text);
}

.hero-subtitle {
  margin: 0;
  max-width: 640px;
  color: var(--sx-muted);
  line-height: 1.55;
}

.dashboard-hero-right {
  min-width: 310px;
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 12px;
}

.hero-stat,
.metric,
.info-card {
  background: rgba(248, 250, 252, 0.86);
  border: 1px solid rgba(226, 232, 240, 0.94);
  border-radius: var(--sx-radius-md);
  padding: 16px;
}

.hero-stat-label,
.info-card-label {
  display: block;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.2;
  color: var(--sx-muted);
  font-weight: 750;
}

.hero-stat-value,
.info-card-value,
.metric b {
  display: block;
  font-size: 24px;
  line-height: 1;
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--sx-primary);
}

.metric span {
  display: block;
  margin-top: 8px;
  font-size: 13px;
  color: var(--sx-muted);
}

/* ---------- Botones ---------- */

.btn,
.btn-primary,
.btn-secondary,
.btn-accent,
.btn-linklike {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border-radius: var(--sx-radius-pill);
  padding: 11px 16px;
  font-weight: 800;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  text-align: center;
  transition:
    transform 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease;
  text-decoration: none;
  border: 1px solid transparent;
  user-select: none;
}

.btn:hover,
.btn-primary:hover,
.btn-secondary:hover,
.btn-accent:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--sx-accent) !important;
  color: #ffffff !important;
  border-color: var(--sx-accent) !important;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.18);
}

.btn-primary:hover {
  background: var(--sx-accent-hover) !important;
  border-color: var(--sx-accent-hover) !important;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.92) !important;
  color: var(--sx-text) !important;
  border-color: var(--sx-border) !important;
}

.btn-secondary:hover {
  background: var(--sx-surface-soft) !important;
  border-color: var(--sx-border-strong) !important;
}

.btn-accent {
  background: var(--sx-primary) !important;
  color: #ffffff !important;
  border-color: var(--sx-primary) !important;
  box-shadow: 0 10px 22px rgba(23, 33, 62, 0.18);
}

.btn-accent:hover {
  background: var(--sx-primary-2) !important;
  border-color: var(--sx-primary-2) !important;
  box-shadow: 0 14px 26px rgba(23, 33, 62, 0.22);
}

.btn-linklike {
  background: transparent !important;
  color: var(--sx-accent) !important;
  padding-inline: 4px;
}

.btn-block,
.w-100 {
  width: 100%;
}

button:disabled,
.btn:disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-accent:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ---------- Formularios ---------- */

label,
.field-label,
.auth-form label,
.form-card label {
  display: block;
  margin-bottom: 7px;
  color: var(--sx-text-soft);
  font-size: 14px;
  font-weight: 800;
}

input,
select,
textarea,
.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 12px 14px;
  margin-top: 6px;
  margin-bottom: 15px;
  border: 1px solid var(--sx-border);
  border-radius: var(--sx-radius-sm);
  background: #ffffff;
  color: var(--sx-text);
  outline: none;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    background 0.16s ease;
}

textarea,
.textarea {
  resize: vertical;
  min-height: 92px;
  line-height: 1.45;
}

select {
  cursor: pointer;
}

input:focus,
select:focus,
textarea:focus,
.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(37, 99, 235, 0.72);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

input::placeholder,
textarea::placeholder {
  color: var(--sx-muted-2);
}

input[type="checkbox"] {
  min-height: auto;
  width: auto;
  margin: 0;
  accent-color: var(--sx-accent);
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* ---------- Login ---------- */

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.auth-subtitle {
  margin: 4px 0 0;
  color: var(--sx-muted);
  line-height: 1.45;
}

.auth-form {
  display: grid;
}

/* ---------- Tabs ---------- */

.tabs,
.admin-tabs {
  display: flex;
  gap: 10px;
  margin: 0;
  flex-wrap: wrap;
}

.tabBtn,
.admin-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 10px 15px;
  border-radius: var(--sx-radius-pill);
  border: 1px solid var(--sx-border);
  background: rgba(255, 255, 255, 0.88);
  color: var(--sx-text-soft);
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
  transition: 0.16s ease;
}

.tabBtn:hover,
.admin-tab:hover {
  background: var(--sx-surface-soft);
  border-color: var(--sx-border-strong);
}

.tabBtn.active,
.admin-tab.active {
  background: var(--sx-primary) !important;
  color: #ffffff !important;
  border-color: var(--sx-primary) !important;
  box-shadow: 0 12px 24px rgba(23, 33, 62, 0.16);
}

.tabPanel {
  margin-top: 18px;
}

/* ---------- Estados ---------- */

.badge,
.status-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: var(--sx-radius-pill);
  font-size: 12px;
  line-height: 1;
  font-weight: 850;
  background: var(--sx-accent-soft);
  color: var(--sx-accent-hover);
  border: 1px solid rgba(37, 99, 235, 0.12);
  white-space: nowrap;
}

.status-pending,
.status-badge.warning {
  background: var(--sx-warning-bg);
  color: var(--sx-warning-text);
  border-color: #fde68a;
}

.status-confirmed {
  background: #dbeafe;
  color: #1e40af;
  border-color: #bfdbfe;
}

.status-attended,
.status-badge.success {
  background: var(--sx-success-bg);
  color: var(--sx-success-text);
  border-color: #bbf7d0;
}

.status-no-show,
.status-badge.danger {
  background: var(--sx-danger-bg);
  color: var(--sx-danger-text);
  border-color: #fecaca;
}

.status-cancelled,
.status-voided {
  background: var(--sx-neutral-bg);
  color: var(--sx-neutral-text);
  border-color: #cbd5e1;
}

/* ---------- Pills / horarios ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--sx-border);
  background: #ffffff;
  color: var(--sx-text);
  border-radius: var(--sx-radius-pill);
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.pill:hover {
  transform: translateY(-1px);
  border-color: var(--sx-border-strong);
  box-shadow: var(--sx-shadow-sm);
}

.pill input {
  width: auto;
  margin: 0;
}

.times-grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.timeBtn {
  cursor: pointer;
  min-width: 82px;
}

.timeBtn.selected,
.pill.is-selected {
  border-color: var(--sx-accent) !important;
  background: var(--sx-accent-soft) !important;
  color: var(--sx-accent-hover) !important;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

/* ---------- Detalles / pacientes ---------- */

.copy-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.copy-row input {
  margin-bottom: 0;
}

.visit-details,
.visit-item-body,
.modal-visit-details {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.visit-detail,
.modal-visit-details div {
  background: var(--sx-surface-soft);
  border: 1px solid var(--sx-border);
  border-radius: var(--sx-radius-sm);
  padding: 12px;
}

.visit-detail span,
.modal-visit-details span {
  display: block;
  margin-bottom: 6px;
  color: var(--sx-muted);
  font-size: 12px;
  font-weight: 750;
}

.visit-detail strong,
.modal-visit-details strong {
  display: block;
  font-size: 14px;
  font-weight: 850;
  word-break: break-word;
}

/* ---------- Mensajes ---------- */

.form-message,
.inline-message,
.msg {
  min-height: 20px;
  margin: 12px 0 0;
  font-size: 14px;
  line-height: 1.4;
}

.form-message.error,
.inline-message.error,
.msg-error {
  color: var(--sx-danger-text) !important;
}

.form-message.success,
.inline-message.success,
.msg-ok {
  color: var(--sx-success-text) !important;
}

/* ---------- Modal ---------- */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  padding: 18px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
}

.modal-card,
.modal-dialog {
  position: relative;
  width: min(92vw, 560px);
  margin: 42px auto;
  background: #ffffff;
  border: 1px solid var(--sx-border);
  border-radius: var(--sx-radius-lg);
  box-shadow: var(--sx-shadow-lg);
  overflow: hidden;
  z-index: 2;
}

.modal-header,
.modal-head {
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  border-bottom: 1px solid var(--sx-border);
}

.modal-title {
  font-weight: 900;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: -0.04em;
  color: var(--sx-text);
}

.modal-body {
  padding: 18px 20px 20px;
}

.modal-close {
  border: 0;
  background: transparent;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  padding: 0 6px;
}

/* Modal paciente compacto */

#patientModal.modal-backdrop,
.action-modal {
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow: hidden;
}

#patientModal[style*="block"],
.action-modal[style*="block"] {
  display: flex !important;
}

#patientModal .modal-card,
.action-modal .modal-card {
  width: min(92vw, 580px);
  max-height: calc(100vh - 32px);
  margin: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#patientModal .modal-header,
.action-modal .modal-header {
  flex: 0 0 auto;
}

#patientModal .modal-body,
.action-modal .modal-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

#patientModalInfo .mini-card {
  padding: 14px;
}

#patientModalInfo .visit-details {
  gap: 10px;
}

#patientModalInfo .visit-detail {
  padding: 10px;
}

.patient-history-scroll {
  display: grid;
  gap: 12px;
  padding-right: 4px;
}

#patientModal .modal-body::-webkit-scrollbar,
.action-modal .modal-body::-webkit-scrollbar {
  width: 8px;
}

#patientModal .modal-body::-webkit-scrollbar-thumb,
.action-modal .modal-body::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: var(--sx-radius-pill);
}

#patientModal .modal-body::-webkit-scrollbar-track,
.action-modal .modal-body::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: var(--sx-radius-pill);
}

/* ---------- Separadores y utilidades ---------- */

.hr {
  border: 0;
  border-top: 1px solid var(--sx-border);
  margin: 20px 0;
}

.hidden {
  display: none !important;
}

.mt-1 {
  margin-top: 6px;
}

.mt-2 {
  margin-top: 10px;
}

.mt-3 {
  margin-top: 16px;
}

.mb-0 {
  margin-bottom: 0;
}

.w-100 {
  width: 100%;
}

/* ---------- Responsive ---------- */

@media (max-width: 920px) {
  .dashboard-hero {
    flex-direction: column;
  }

  .dashboard-hero-right {
    min-width: 100%;
  }

  .grid-2,
  .grid-3,
  .form-row-2,
  .form-row-3,
  .form-grid,
  .admin-grid,
  .info-grid,
  .visit-details,
  .visit-item-body,
  .copy-row,
  .modal-visit-details {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .navbar {
    align-items: flex-start;
  }

  .nav-cta {
    width: 100%;
  }

  .nav-cta > * {
    width: 100%;
  }

  .dashboard-page,
  .admin-page,
  .page-shell {
    padding: 14px 10px 34px;
  }

  .card {
    padding: 18px;
    border-radius: var(--sx-radius-md);
  }

  .dashboard-hero-right {
    grid-template-columns: 1fr;
  }

  .hero-stat-value,
  .metric b {
    font-size: 22px;
  }

  .section-actions,
  .card-actions,
  .dashboard-actions {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .section-actions > *,
  .card-actions > *,
  .dashboard-actions > * {
    width: 100%;
  }

  .tabs,
  .admin-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .tabBtn,
  .admin-tab {
    width: 100%;
  }

  .timeBtn {
    width: calc(50% - 5px);
  }

  .modal-backdrop,
  #patientModal.modal-backdrop,
  .action-modal {
    padding: 10px;
  }

  .modal-card,
  #patientModal .modal-card,
  .action-modal .modal-card {
    width: 96vw;
    max-height: calc(100vh - 20px);
    border-radius: var(--sx-radius-md);
  }

  .modal-header,
  #patientModal .modal-header,
  .action-modal .modal-header {
    padding: 16px;
  }

  .modal-body,
  #patientModal .modal-body,
  .action-modal .modal-body {
    padding: 16px;
  }
}

@media (max-width: 420px) {
  .brand-logo {
    width: 42px;
    height: 42px;
  }

  .brand-title-small {
    font-size: 16px;
  }

  .timeBtn {
    width: 100%;
  }
}