/* ============================================================
   SOSATI — Shared Styles
   Brand: #29156e (azul) / #ffffff (blanco)
   Google Font: DM Sans + Playfair Display
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=Playfair+Display:wght@600;700&display=swap');

/* ── VARIABLES ──────────────────────────────────────────── */
:root {
  --brand:        #29156e;
  --brand-dark:   #1a0d4e;
  --brand-light:  #3d2490;
  --brand-soft:   #ede9f8;
  --brand-alpha:  rgba(41, 21, 110, 0.08);
  --white:        #ffffff;
  --gray-50:      #f8f7fc;
  --gray-100:     #f0eef9;
  --gray-200:     #dddaf0;
  --gray-400:     #9b96c2;
  --gray-600:     #5d5880;
  --gray-800:     #2d2a45;
  --success:      #10b981;
  --warning:      #f59e0b;
  --error:        #ef4444;
  --info:         #6366f1;

  --font-body:    'DM Sans', sans-serif;
  --font-display: 'Playfair Display', serif;

  --radius-sm:    8px;
  --radius-md:    14px;
  --radius-lg:    22px;
  --radius-full:  999px;

  --shadow-sm:    0 2px 8px rgba(41,21,110,0.08);
  --shadow-md:    0 6px 24px rgba(41,21,110,0.14);
  --shadow-lg:    0 16px 48px rgba(41,21,110,0.2);

  --transition:   all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--gray-50);
  color: var(--gray-800);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── HEADER ─────────────────────────────────────────────── */
.sosati-header {
  background: var(--brand);
  padding: 18px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 16px rgba(41,21,110,0.3);
}

.sosati-logo {
  width: 42px;
  height: 42px;
  background: var(--white);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  font-family: var(--font-display);
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.sosati-header-text h1 {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--white);
  font-weight: 600;
  line-height: 1.2;
}

.sosati-header-text p {
  font-size: 12px;
  color: rgba(255,255,255,0.7);
  font-weight: 400;
}

/* ── CONTAINER ──────────────────────────────────────────── */
.sosati-container {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px 80px;
}

/* ── CARD ───────────────────────────────────────────────── */
.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-100);
  margin-bottom: 16px;
  animation: fadeUp 0.4s ease both;
}

.card-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--brand);
  margin-bottom: 6px;
}

.card-subtitle {
  font-size: 13.5px;
  color: var(--gray-600);
  margin-bottom: 22px;
}

/* ── FORM ───────────────────────────────────────────────── */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 7px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--gray-800);
  background: var(--white);
  transition: var(--transition);
  outline: none;
  -webkit-appearance: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-alpha);
  background: var(--white);
}

.form-input::placeholder { color: var(--gray-400); }

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2329156e' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
  cursor: pointer;
}

.form-textarea { resize: vertical; min-height: 90px; }

.form-error {
  font-size: 12px;
  color: var(--error);
  margin-top: 5px;
  display: none;
}

.form-group.has-error .form-input,
.form-group.has-error .form-select {
  border-color: var(--error);
}

.form-group.has-error .form-error { display: block; }

/* ── TIME SLOTS ─────────────────────────────────────────── */
.time-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 8px;
}

.time-slot {
  padding: 10px 6px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--gray-600);
  cursor: pointer;
  transition: var(--transition);
  background: var(--white);
  user-select: none;
}

.time-slot:hover:not(.taken) {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-alpha);
}

.time-slot.selected {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--white);
  box-shadow: var(--shadow-sm);
}

.time-slot.taken {
  opacity: 0.4;
  cursor: not-allowed;
  text-decoration: line-through;
}

/* ── BUTTON ─────────────────────────────────────────────── */
.btn {
  display: block;
  width: 100%;
  padding: 15px 24px;
  border-radius: var(--radius-full);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
  text-align: center;
  text-decoration: none;
  letter-spacing: 0.2px;
}

.btn-primary {
  background: var(--brand);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(41,21,110,0.35);
}

.btn-primary:hover {
  background: var(--brand-light);
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(41,21,110,0.4);
}

.btn-primary:active { transform: translateY(0); }

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: none;
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-sm {
  width: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--brand);
  color: var(--brand);
}

.btn-outline:hover {
  background: var(--brand);
  color: var(--white);
}

/* ── BADGE DE ESTADO ─────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}

.badge-pending   { background: #fef3c7; color: #d97706; }
.badge-confirmed { background: #d1fae5; color: #059669; }
.badge-completed { background: #e0e7ff; color: #4338ca; }
.badge-cancelled { background: #fee2e2; color: #dc2626; }

/* ── APPOINTMENT CARD ────────────────────────────────────── */
.appt-card {
  background: var(--white);
  border: 1px solid var(--gray-100);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-sm);
  animation: fadeUp 0.3s ease both;
  transition: var(--transition);
}

.appt-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }

.appt-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.appt-name {
  font-weight: 600;
  font-size: 15px;
  color: var(--gray-800);
}

.appt-id {
  font-size: 10.5px;
  color: var(--gray-400);
  font-weight: 500;
  font-family: monospace;
  background: var(--gray-50);
  padding: 2px 6px;
  border-radius: 4px;
}

.appt-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.appt-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--gray-600);
  background: var(--gray-50);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--gray-100);
}

.appt-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── TOAST ──────────────────────────────────────────────── */
#sosati-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--gray-800);
  color: var(--white);
  padding: 12px 22px;
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap;
  pointer-events: none;
}

#sosati-toast.show {
  transform: translateX(-50%) translateY(0);
}

#sosati-toast.success { background: var(--success); }
#sosati-toast.error   { background: var(--error); }
#sosati-toast.info    { background: var(--brand); }

/* ── LOADER ─────────────────────────────────────────────── */
.loader {
  width: 22px;
  height: 22px;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
  margin: 0 auto;
}

/* ── ANIMATIONS ──────────────────────────────────────────── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.5; }
}

/* ── DIVIDER ─────────────────────────────────────────────── */
.divider {
  border: none;
  border-top: 1px solid var(--gray-100);
  margin: 18px 0;
}

/* ── EMPTY STATE ─────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--gray-400);
}

.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── RESPONSIVE ─────────────────────────────────────────── */
@media (max-width: 380px) {
  .sosati-container { padding: 16px 12px 80px; }
  .card { padding: 22px 18px; }
  .time-grid { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .time-slot { font-size: 12.5px; padding: 9px 4px; }
}

/* Toast helper (JS function) */
/* Usar: showToast("mensaje", "success" | "error" | "info") */
