/* ═══════════════════════════════════════════════════════════
   AUREA — Estética Clínica
   styles.css — Minimal Blanco (default) + Dark Premium
   ═══════════════════════════════════════════════════════════ */

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

/* ── TEMA CLARO (default) ─────────────────────────────────── */
:root {
  --bg:        #f7f7f8;
  --surface:   #ffffff;
  --surface2:  #f3f3f5;
  --border:    #e8e8ec;
  --gold:      #9b6f3a;
  --gold-light:#b8863c;
  --gold-dim:  rgba(155,111,58,0.08);
  --text:      #111111;
  --text-muted:#888892;
  --rose:      #d94f4f;
  --green:     #2d8a5e;
  --blue:      #2d6fbf;
  --ease:      cubic-bezier(0.4,0,0.2,1);
}

/* ── TEMA OSCURO ──────────────────────────────────────────── */
body.dark {
  --bg:        #0a0a0c;
  --surface:   #111114;
  --surface2:  #18181d;
  --border:    #26262e;
  --gold:      #c9a86c;
  --gold-light:#e8cc99;
  --gold-dim:  rgba(201,168,108,0.12);
  --text:      #e8e6e0;
  --text-muted:#66666e;
  --rose:      #c97070;
  --green:     #6faf8f;
  --blue:      #6f9fcf;
  --ease:      cubic-bezier(0.4,0,0.2,1);
}

/* ── BASE ─────────────────────────────────────────────────── */
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  transition: background 0.25s ease, color 0.25s ease;
}

.app { display: flex; height: 100vh; }

/* ── ANIMACIONES ──────────────────────────────────────────── */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}
@keyframes overlayFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-5px); }
  40%     { transform: translateX(5px); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}

.page-enter { animation: fadeSlideIn 0.25s var(--ease) both; }

.stat-card                  { animation: fadeSlideIn 0.30s both; }
.stat-card:nth-child(1)     { animation-delay: 0.03s; }
.stat-card:nth-child(2)     { animation-delay: 0.08s; }
.stat-card:nth-child(3)     { animation-delay: 0.13s; }
.stat-card:nth-child(4)     { animation-delay: 0.18s; }

tbody tr                    { animation: fadeSlideIn 0.22s both; }
tbody tr:nth-child(1)       { animation-delay: 0.03s; }
tbody tr:nth-child(2)       { animation-delay: 0.07s; }
tbody tr:nth-child(3)       { animation-delay: 0.11s; }
tbody tr:nth-child(4)       { animation-delay: 0.15s; }
tbody tr:nth-child(5)       { animation-delay: 0.19s; }
tbody tr:nth-child(6)       { animation-delay: 0.23s; }

/* ── SIDEBAR ──────────────────────────────────────────────── */
.sidebar {
  width: 220px; min-width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0;
  height: 100vh;
  overflow-y: auto; overflow-x: hidden;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.logo {
  padding: 0 20px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.logo h1 {
  font-size: 17px; font-weight: 500;
  letter-spacing: 5px; color: var(--gold);
  text-transform: uppercase;
}
.logo p {
  font-size: 9px; color: var(--text-muted);
  letter-spacing: 1.5px; text-transform: uppercase;
  margin-top: 5px; opacity: 0.7;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 20px; cursor: pointer;
  transition: color 0.18s, background 0.18s;
  color: var(--text-muted); font-size: 13px;
  font-weight: 400; user-select: none;
  border-radius: 0; margin: 1px 0;
}
.nav-item:hover { color: var(--text); background: var(--surface2); }
.nav-item.active {
  color: var(--text);
  background: var(--gold-dim);
  font-weight: 500;
  border-left: 2px solid var(--gold);
  padding-left: 18px;
}
.nav-icon { font-size: 13px; width: 18px; text-align: center; opacity: 0.6; }
.nav-item.active .nav-icon { opacity: 1; color: var(--gold); }

.sidebar-footer {
  margin-top: auto;
  padding: 16px 20px 0;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.sidebar-footer p { font-size: 11px; color: var(--text-muted); }

/* ── LAYOUT PRINCIPAL ─────────────────────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between;
  transition: background 0.25s ease;
}
.topbar-title {
  font-size: 20px; font-weight: 500; color: var(--text);
  letter-spacing: -0.2px;
}
.topbar-right {
  display: flex; gap: 12px; align-items: center;
  font-size: 12px; color: var(--text-muted);
}

.content { flex: 1; overflow-y: auto; padding: 24px 28px; }
.content::-webkit-scrollbar       { width: 4px; }
.content::-webkit-scrollbar-track { background: transparent; }
.content::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── BOTONES ──────────────────────────────────────────────── */
.btn {
  padding: 7px 16px; border: 1px solid transparent;
  border-radius: 7px; cursor: pointer;
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px; font-weight: 500;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }

.btn-gold {
  background: var(--gold); color: #fff;
  border-color: var(--gold);
}
.btn-gold:hover { background: var(--gold-light); border-color: var(--gold-light); }

.btn-outline {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-outline:hover { border-color: var(--text-muted); color: var(--text); }

.btn-close {
  background: transparent;
  color: var(--rose);
  border-color: var(--border);
  font-weight: 500;
}
.btn-close:hover { border-color: var(--rose); background: rgba(217,79,79,0.06); }

.btn-sm { padding: 4px 11px; font-size: 12px; }

/* ── TARJETAS ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 20px;
  transition: background 0.25s ease, border-color 0.25s ease;
}

.stat-grid {
  display: grid; grid-template-columns: repeat(4,1fr);
  gap: 12px; margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px; padding: 18px 20px;
  position: relative; overflow: hidden;
  transition: border-color 0.18s, background 0.25s ease;
}
.stat-card:hover { border-color: var(--gold); }
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; right: 0; height: 1px;
  opacity: 0.6;
}
.stat-card.gold::before  { background: linear-gradient(90deg, var(--gold), transparent); }
.stat-card.rose::before  { background: linear-gradient(90deg, var(--rose), transparent); }
.stat-card.green::before { background: linear-gradient(90deg, var(--green), transparent); }
.stat-card.blue::before  { background: linear-gradient(90deg, var(--blue), transparent); }
.stat-card:hover { border-color: var(--gold); box-shadow: 0 2px 12px rgba(0,0,0,0.06); }

.stat-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
.stat-value { font-size: 32px; font-weight: 300; margin: 6px 0 2px; }
.stat-sub   { font-size: 11px; color: var(--text-muted); }

/* ── TABLA ────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table       { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 9px 14px;
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  border-bottom: 1px solid var(--border); font-weight: 500;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
  transition: background 0.15s;
  color: var(--text);
}
tr:hover td      { background: var(--surface2); }
tr:last-child td { border-bottom: none; }

/* ── BADGES ───────────────────────────────────────────────── */
.badge       { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 11px; font-weight: 500; }
.badge-gold  { background: var(--gold-dim); color: var(--gold); }
.badge-green { background: rgba(45,138,94,0.10); color: var(--green); }
.badge-rose  { background: rgba(217,79,79,0.10); color: var(--rose); }
.badge-blue  { background: rgba(45,111,191,0.10); color: var(--blue); }
.badge-gray  { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); }

/* ── FORMULARIOS ──────────────────────────────────────────── */
.form-grid  { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }

label {
  font-size: 11px; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  font-weight: 500;
}

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 11px;
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  font-size: 13px; outline: none; width: 100%;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}
.input-error {
  border-color: var(--rose) !important;
  box-shadow: 0 0 0 3px rgba(217,79,79,0.10) !important;
}
textarea      { resize: vertical; min-height: 80px; }
select option { background: var(--surface2); color: var(--text); }

.form-error-msg {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(217,79,79,0.06);
  border: 1px solid rgba(217,79,79,0.3);
  border-left: 3px solid var(--rose);
  border-radius: 8px; padding: 10px 14px;
  color: var(--rose); font-size: 13px; font-weight: 500;
  animation: shake 0.28s ease, fadeSlideIn 0.2s ease;
  grid-column: 1 / -1; margin-bottom: 4px;
}
.form-error-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }

/* ── MODAL ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 100; backdrop-filter: blur(6px);
  animation: overlayFade 0.29s ease both;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; padding: 28px;
  width: 560px; max-width: 95vw; max-height: 88vh;
  overflow-y: auto;
  animation: scaleUp 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
  box-shadow: 0 16px 48px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
}
.modal-wide {
  width: min(900px, 92vw) !important;
}
.modal .table-wrap {
  overflow-x: auto;
}
.modal-header {
  display: flex; align-items: center;
  justify-content: space-between; margin-bottom: 20px;
}
.modal-header h2 {
  font-size: 18px; font-weight: 500; color: var(--text);
}
.modal-x {
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.modal-x:hover { background: var(--border); color: var(--text); }
.modal-actions {
  display: flex;
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
.modal-actions .btn {
  flex-shrink: 0;
}

/* ── BÚSQUEDA ─────────────────────────────────────────────── */
.search-bar       { position: relative; margin-bottom: 20px; }
.search-bar input { padding-left: 34px; }
.search-icon {
  position: absolute; left: 11px; top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted); font-size: 13px; pointer-events: none;
}

/* ── ENCABEZADOS DE SECCIÓN ───────────────────────────────── */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.section-title  { font-size: 18px; font-weight: 500; color: var(--text); }

/* ── DETALLE DE PACIENTE ──────────────────────────────────── */
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 20px; }
.detail-item label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); margin-bottom: 4px; }
.detail-item p { font-size: 14px; color: var(--text); }

/* ── TIMELINE ─────────────────────────────────────────────── */
.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute;
  left: 6px; top: 0; bottom: 0;
  width: 1px; background: var(--border);
}
.timeline-item    { position: relative; padding-bottom: 18px; animation: fadeSlideIn 0.24s both; }
.timeline-dot     { position: absolute; left: -18px; top: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--gold); border: 2px solid var(--bg); }
.timeline-date    { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.timeline-content { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px; transition: border-color 0.15s; }
.timeline-content:hover { border-color: var(--gold); }
.timeline-title   { font-size: 13px; font-weight: 500; margin-bottom: 3px; color: var(--text); }
.timeline-desc    { font-size: 12px; color: var(--text-muted); }

/* ── AGENDA ───────────────────────────────────────────────── */
.agenda-grid { display: grid; grid-template-columns: 190px 1fr; gap: 16px; }
.day-list    { display: flex; flex-direction: column; gap: 6px; }
.day-btn {
  padding: 9px 13px; border-radius: 8px; cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  border: 1px solid var(--border); background: var(--surface);
  user-select: none;
}
.day-btn:hover  { border-color: var(--gold); }
.day-btn.active { border-color: var(--gold); background: var(--gold-dim); }
.day-btn .day-name  { font-size: 13px; font-weight: 500; color: var(--text); }
.day-btn .day-count { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.appointments-list { display: flex; flex-direction: column; gap: 8px; }
.appointment-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 16px;
  display: flex; align-items: center; gap: 14px;
  border-left: 3px solid var(--gold);
  animation: fadeSlideIn 0.24s both;
  transition: border-color 0.15s, background 0.15s;
}
.appointment-card:hover { background: var(--surface2); }
.appointment-card:nth-child(1) { animation-delay: 0.02s; }
.appointment-card:nth-child(2) { animation-delay: 0.07s; }
.appointment-card:nth-child(3) { animation-delay: 0.12s; }
.appointment-time      { font-size: 16px; font-weight: 500; min-width: 55px; color: var(--gold); }
.appointment-info      { flex: 1; }
.appointment-name      { font-size: 13px; font-weight: 500; color: var(--text); }
.appointment-treatment { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── PAGOS ────────────────────────────────────────────────── */
.payment-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; margin-bottom: 20px; }

/* ── TABS ─────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 2px; margin-bottom: 20px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px; padding: 3px; width: fit-content;
}
.tab {
  padding: 6px 14px; border-radius: 6px; cursor: pointer;
  font-size: 13px; color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.tab:hover:not(.active) { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 500;
  border: 1px solid var(--border);
}

/* ── AVATAR ───────────────────────────────────────────────── */
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; color: var(--gold); font-weight: 600;
  flex-shrink: 0; transition: transform 0.15s;
  border: 1px solid var(--border);
}
tr:hover .avatar { transform: scale(1.08); }

/* ── UTILIDADES ───────────────────────────────────────────── */
.two-col       { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.dash-row-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; background: var(--surface2); border-radius: 8px; border: 1px solid var(--border); transition: border-color 0.15s; }
.dash-row-item:hover { border-color: var(--gold); }
.progress-fill { height: 100%; border-radius: 4px; background: var(--gold); transition: width 0.5s var(--ease); }

.empty-state      { text-align: center; padding: 48px 20px; color: var(--text-muted); animation: fadeIn 0.3s both; }
.empty-state .empty-icon { font-size: 36px; margin-bottom: 10px; opacity: 0.35; }
.empty-state p    { font-size: 13px; }

.turno-meta { text-align: right; flex-shrink: 0; }

/* ── HAMBURGER ────────────────────────────────────────────── */
.hamburger { display: none; }

/* ── RESPONSIVE MOBILE ────────────────────────────────────── */
@media (max-width: 768px) {

  .hamburger {
    display: block;
    background: transparent;
    border: none;
    color: var(--text);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    line-height: 1;
  }

  .app { position: relative; }

  .modal-actions { justify-content: flex-start; }

  .sidebar {
    position: fixed;
    left: -240px;
    top: 0; bottom: 0;
    z-index: 200;
    width: 240px;
    transition: left 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: none;
  }

  .sidebar.open {
    left: 0;
    box-shadow: 4px 0 20px rgba(0,0,0,0.12);
  }

  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 199;
    backdrop-filter: blur(2px);
  }

  .sidebar-overlay.visible { display: block; }

  /* Topbar — ocultar info secundaria */
  .topbar { padding: 12px 16px; }
  .topbar-right { display: none; }

  /* Contenido */
  .content { padding: 14px 14px 80px; }

  /* Stat grid — 1 columna en mobile */
  .stat-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Stat cards — más compactas */
  .stat-card { padding: 14px 16px; }
  .stat-value { font-size: 26px; }

  /* Grids */
  .payment-summary { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .form-grid       { grid-template-columns: 1fr; }
  .detail-grid     { grid-template-columns: 1fr; }
  .two-col         { grid-template-columns: 1fr; }
  .agenda-grid     { grid-template-columns: 1fr; }

  .payment-summary .stat-value { font-size: 18px; }
  .payment-summary .stat-card  { padding: 12px; }

  /* Turnos — fecha y hora abajo */
  .appointment-card {
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
  }
  .appointment-card > div:last-child {
    width: 100%;
    text-align: left;
    font-size: 11px;
    color: var(--text-muted);
  }
  .appointment-time {
    font-size: 15px;
    min-width: auto;
  }

  /* Modales — full bottom sheet en mobile */
  .modal-overlay {
    align-items: flex-end;
  }
  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    animation: slideUp 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
    padding: 20px 18px;
  }

  /* Tablas — scroll horizontal */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  table { min-width: 500px; }

  .dash-row-item { flex-wrap: wrap; gap: 6px; }
  .turno-meta {
  width: 100%;
  text-align: left;
  display: flex;
  gap: 8px;
  align-items: center;
  padding-top: 4px;
  border-top: 1px solid var(--border);
  margin-top: 2px;
}
}

/* Animación slide up para modales mobile */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(100%); }
  to   { opacity: 1; transform: translateY(0); }
}