/* ═══════════════════════════════════════════════════════════════════════════
   appointments.css — Vista de Agendar Cita
   Open World Agency — Light UI / Red Accent Design System
   ═══════════════════════════════════════════════════════════════════════════ */

/* ── Page Layout ─────────────────────────────────────────────────────────── */
.appt-page {
  min-height: 100vh;
  background: #f8fafc;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.appt-hero {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, .72) 0%, rgba(0, 0, 0, .64) 48%, rgba(0, 0, 0, .72) 100%),
    url("../img/portada%20owa.jpeg");
  background-size: cover;
  background-position: center;
  padding: 48px 0 64px;
  position: relative;
  overflow: hidden;
}

.appt-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  pointer-events: none;
}

.appt-hero__inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
  position: relative;
  z-index: 1;
}

.appt-hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(239, 68, 68, .15);
  border: 1px solid rgba(239, 68, 68, .30);
  color: #fca5a5;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}

.appt-hero__title {
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 800;
  color: #ffffff;
  line-height: 1.15;
  margin: 0 0 10px;
}

.appt-hero__title span {
  color: #f87171;
}

.appt-hero__subtitle {
  font-size: 15px;
  color: rgba(255, 255, 255, .60);
  max-width: 520px;
  line-height: 1.6;
}

/* ── Main Content Grid ───────────────────────────────────────────────────── */
.appt-container {
  max-width: 1120px;
  margin: -32px auto 60px;
  padding: 0 24px;
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
  position: relative;
  z-index: 2;
}

/* ── Card base ───────────────────────────────────────────────────────────── */
.appt-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .06), 0 4px 16px rgba(15, 23, 42, .04);
  overflow: hidden;
}

.appt-card__header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  gap: 10px;
}

.appt-card__header-icon {
  width: 24px;
  height: 24px;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.appt-card__header-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
}

.appt-card__header-sub {
  font-size: 12px;
  color: #6b7280;
  margin-top: 1px;
}

.appt-card__body {
  padding: 20px 24px 24px;
}

/* ── Step indicators ─────────────────────────────────────────────────────── */
.appt-steps {
  display: flex;
  gap: 0;
  margin-bottom: 28px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e5e7eb;
  background: #ffffff;
}

.appt-step {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 8px;
  background: #f9fafb;
  font-size: 12.5px;
  font-weight: 600;
  color: #9ca3af;
  border-right: 1px solid #e5e7eb;
  transition: background .2s, color .2s;
}

.appt-step:last-child { border-right: none; }

.appt-step__num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .2s, color .2s;
}

.appt-step.active {
  background: #ffffff;
  color: #dc2626;
}

.appt-step.active .appt-step__num {
  background: #ef4444;
  color: #ffffff;
}

.appt-step.done {
  background: #ffffff;
  color: #16a34a;
}

.appt-step.done .appt-step__num {
  background: #22c55e;
  color: #ffffff;
}

/* ── Appointment type selector ───────────────────────────────────────────── */
.appt-type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.appt-type-card {
  border: 2px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px 16px;
  cursor: pointer;
  transition: border-color .18s, background .18s, box-shadow .18s, transform .14s;
  background: #ffffff;
  user-select: none;
  position: relative;
  overflow: hidden;
}

.appt-type-card:hover {
  border-color: #fca5a5;
  background: #fff7f7;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(239, 68, 68, .08);
}

.appt-type-card.selected {
  border-color: #ef4444;
  background: #ffffff;
  box-shadow: none;
}

.appt-type-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.appt-type-card__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #fef2f2;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 10px;
  transition: background .18s;
}

.appt-type-card.selected .appt-type-card__icon {
  background: #ef4444;
  color: #ffffff;
}

.appt-type-card__title {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 3px;
}

.appt-type-card__desc {
  font-size: 12px;
  color: #6b7280;
  line-height: 1.4;
}

.appt-type-card.selected .appt-type-card__desc {
  color: #6b7280;
}

/* ── Calendar ────────────────────────────────────────────────────────────── */
.appt-calendar {
  user-select: none;
}

.appt-cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.appt-cal-nav__btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #ffffff;
  color: #374151;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  transition: background .16s, border-color .16s, color .16s;
}

.appt-cal-nav__btn:hover:not(:disabled) {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
}

.appt-cal-nav__btn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.appt-cal-nav__month {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  text-transform: capitalize;
}

.appt-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.appt-cal-weekday {
  font-size: 11px;
  font-weight: 700;
  color: #9ca3af;
  text-align: center;
  padding: 4px 0 8px;
  text-transform: uppercase;
  letter-spacing: .4px;
}

.appt-cal-day {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  position: relative;
}

.appt-cal-day:hover:not(.disabled):not(.empty):not(.selected) {
  background: #fef2f2;
  border-color: #fca5a5;
  color: #dc2626;
  transform: scale(1.05);
}

.appt-cal-day.today {
  border-color: rgba(239, 68, 68, .40);
  font-weight: 700;
}

.appt-cal-day.selected {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(239, 68, 68, .30);
}

.appt-cal-day.disabled {
  color: #d1d5db;
  cursor: not-allowed;
  background: #f9fafb;
}

.appt-cal-day.empty {
  cursor: default;
}

.appt-cal-day.other-month {
  color: #d1d5db;
}

/* Dot indicator de disponibilidad */
.appt-cal-day.has-slots::after {
  content: '';
  position: absolute;
  bottom: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #22c55e;
}

.appt-cal-day.selected.has-slots::after {
  background: rgba(255,255,255,.8);
}

/* ── Time Slots ──────────────────────────────────────────────────────────── */
.appt-slots-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.appt-slots-title {
  font-size: 13px;
  font-weight: 700;
  color: #111827;
}

.appt-slots-date {
  font-size: 12px;
  color: #6b7280;
  background: #f1f5f9;
  padding: 3px 10px;
  border-radius: 999px;
}

.appt-slots-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.appt-slot {
  padding: 9px 4px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  background: #ffffff;
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s, transform .1s, box-shadow .15s;
}

.appt-slot:hover:not(.occupied):not(.selected) {
  border-color: #fca5a5;
  background: #fff7f7;
  color: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(239, 68, 68, .10);
}

.appt-slot.selected {
  border-color: #ef4444;
  border-width: 2px;
  background: #fff1f2;
  color: #dc2626;
  font-weight: 700;
}

.appt-slot.occupied {
  background: #f3f4f6;
  color: #d1d5db;
  cursor: not-allowed;
  text-decoration: line-through;
  border-color: #f3f4f6;
}

.appt-slots-empty {
  text-align: center;
  padding: 24px 0;
  color: #9ca3af;
  font-size: 13px;
}

.appt-slots-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 20px 0;
  color: #9ca3af;
  font-size: 13px;
}

/* ── Form ────────────────────────────────────────────────────────────────── */
.appt-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.appt-form-full {
  grid-column: 1 / -1;
}

.appt-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.appt-form-label {
  font-size: 12.5px;
  font-weight: 600;
  color: #374151;
}

.appt-form-label .required {
  color: #ef4444;
  margin-left: 2px;
}

.appt-form-input,
.appt-form-select,
.appt-form-textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  font-size: 13.5px;
  color: #111827;
  background: #ffffff;
  transition: border-color .18s, box-shadow .18s;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.appt-form-input:focus,
.appt-form-select:focus,
.appt-form-textarea:focus {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .12);
}

.appt-form-input.error,
.appt-form-select.error,
.appt-form-textarea.error {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, .10);
}

.appt-form-error {
  font-size: 11.5px;
  color: #dc2626;
  display: none;
}

.appt-form-error.visible {
  display: block;
}

.appt-form-textarea {
  resize: vertical;
  min-height: 90px;
}

.appt-form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* Prefilled/preloaded field indicator */
.appt-form-input.prefilled,
.appt-form-select.prefilled {
  background: #f0fdf4;
  border-color: #86efac;
  color: #166534;
}

.appt-prefilled-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  color: #16a34a;
  background: #f0fdf4;
  border: 1px solid #86efac;
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 10px;
}

/* ── Sidebar / Summary Card ──────────────────────────────────────────────── */
.appt-sidebar {
  position: sticky;
  top: 80px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.appt-summary {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .06);
}

.appt-summary__header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 18px 20px;
}

.appt-summary__header-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 2px;
}

.appt-summary__header-sub {
  font-size: 11.5px;
  color: rgba(255,255,255,.50);
}

.appt-summary__body {
  padding: 16px 20px;
}

.appt-summary__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f1f5f9;
}

.appt-summary__row:last-child {
  border-bottom: none;
}

.appt-summary__row-icon {
  width: 20px;
  height: 20px;
  color: #374151;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 1px;
}

.appt-summary__row-label {
  font-size: 11px;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .4px;
  font-weight: 600;
  margin-bottom: 2px;
}

.appt-summary__row-value {
  font-size: 13.5px;
  font-weight: 600;
  color: #111827;
}

.appt-summary__row-value.placeholder {
  color: #d1d5db;
  font-style: italic;
  font-weight: 400;
}

/* ── CTA Button ──────────────────────────────────────────────────────────── */
.appt-cta {
  width: 100%;
  padding: 14px 20px;
  background: #ef4444;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background .18s, transform .14s, box-shadow .18s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  outline-offset: 3px;
  font-family: inherit;
}

.appt-cta:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(239, 68, 68, .30);
}

.appt-cta:disabled {
  background: #d1d5db;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.appt-cta i {
  font-size: 17px;
}

/* Loading spinner on CTA */
.appt-cta .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Info note ───────────────────────────────────────────────────────────── */
.appt-info-note {
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 12.5px;
  line-height: 1.5;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.appt-info-note.virtual {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1d4ed8;
}

.appt-info-note.presencial {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
}

.appt-info-note i {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ── Toast / Alert ───────────────────────────────────────────────────────── */
.appt-toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9999;
  max-width: 360px;
  border-radius: 14px;
  box-shadow: 0 10px 40px rgba(15, 23, 42, .18);
  padding: 14px 18px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  animation: toastIn .25s cubic-bezier(.16,1,.3,1);
  font-size: 13.5px;
}

.appt-toast.error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #dc2626;
}

.appt-toast.success {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
}

.appt-toast i {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── Confirmation Page ───────────────────────────────────────────────────── */
.appt-confirm-page {
  min-height: 100vh;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 60px 24px 80px;
}

.appt-confirm-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(15, 23, 42, .08);
  max-width: 580px;
  width: 100%;
  overflow: hidden;
}

.appt-confirm-card__top {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  padding: 36px 32px;
  text-align: center;
  position: relative;
}

.appt-confirm-card__check {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #22c55e;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 34px;
  margin: 0 auto 18px;
  box-shadow: 0 0 0 10px rgba(34, 197, 94, .15);
  animation: checkPop .45s cubic-bezier(.16,1,.3,1);
}

@keyframes checkPop {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

.appt-confirm-card__title {
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 6px;
}

.appt-confirm-card__subtitle {
  font-size: 14px;
  color: rgba(255,255,255,.55);
}

.appt-confirm-card__body {
  padding: 28px 32px 32px;
}

.appt-confirm-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid #f1f5f9;
}

.appt-confirm-row:last-child { border-bottom: none; }

.appt-confirm-row__icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #fef2f2;
  color: #ef4444;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.appt-confirm-row__label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 3px;
}

.appt-confirm-row__value {
  font-size: 14.5px;
  font-weight: 600;
  color: #111827;
}

.appt-confirm-note {
  margin-top: 20px;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.appt-confirm-note.virtual {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e40af;
}

.appt-confirm-note.presencial {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #166534;
}

.appt-confirm-note i {
  font-size: 18px;
  flex-shrink: 0;
  margin-top: 1px;
}

.appt-confirm-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

.appt-confirm-btn {
  flex: 1;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: background .18s, transform .14s;
  font-family: inherit;
  cursor: pointer;
}

.appt-confirm-btn--primary {
  background: #ef4444;
  color: #ffffff;
  border: none;
}

.appt-confirm-btn--primary:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

.appt-confirm-btn--secondary {
  background: #f8fafc;
  color: #374151;
  border: 1px solid #e5e7eb;
}

.appt-confirm-btn--secondary:hover {
  background: #f1f5f9;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .appt-container {
    grid-template-columns: 1fr;
  }

  .appt-sidebar {
    position: static;
    order: -1;
  }
}

@media (max-width: 640px) {
  .appt-hero {
    padding: 36px 0 56px;
  }

  .appt-container {
    margin-top: -24px;
    padding: 0 16px;
  }

  .appt-card__body {
    padding: 16px;
  }

  .appt-form-grid {
    grid-template-columns: 1fr;
  }

  .appt-slots-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .appt-type-grid {
    grid-template-columns: 1fr;
  }

  .appt-steps {
    flex-direction: column;
    border-radius: 12px;
  }

  .appt-step {
    border-right: none;
    border-bottom: 1px solid #e5e7eb;
    justify-content: flex-start;
    padding: 10px 14px;
  }

  .appt-step:last-child { border-bottom: none; }

  .appt-confirm-card__top {
    padding: 28px 20px;
  }

  .appt-confirm-card__body {
    padding: 20px;
  }

  .appt-confirm-actions {
    flex-direction: column;
  }

  .appt-toast {
    left: 16px;
    right: 16px;
    bottom: 16px;
    max-width: unset;
  }
}

@media (max-width: 420px) {
  .appt-slots-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .appt-cal-grid {
    gap: 2px;
  }

  .appt-cal-weekday,
  .appt-cal-day {
    font-size: 11px;
  }
}
