/* ============================================================
   Citas Ubikalo — Design System v2.0
   Estilo moderno con sidebar, glassmorphism y micro-animaciones
   ============================================================ */

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

/* ── Variables ── */
:root {
  --brand:        #5b6af0;
  --brand-dark:   #4451d3;
  --brand-light:  #eef0ff;
  --accent:       #f97316;
  --success:      #10b981;
  --danger:       #ef4444;
  --warning:      #f59e0b;

  --bg:           #f8f9ff;
  --surface:      #ffffff;
  --sidebar-bg:   #1e1f3b;
  --sidebar-text: #c8cae8;
  --sidebar-head: #ffffff;

  --text-primary:   #1a1b3a;
  --text-secondary: #64748b;
  --text-muted:     #94a3b8;
  --border:         #e2e8f4;

  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --shadow-sm:  0 1px 4px rgba(0,0,0,.08);
  --shadow-md:  0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:  0 12px 40px rgba(0,0,0,.14);

  --sidebar-w:  300px;
  --transition: 0.2s ease;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; transition: opacity var(--transition); }
a:hover { opacity: .8; }
img { max-width: 100%; display: block; }

/* ── Layout Principal ── */
.page-layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 40px 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--brand);
  font-weight: 600;
  margin-bottom: 36px;
  opacity: .9;
}

.advisor-avatar {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  overflow: hidden;
  margin-bottom: 20px;
  border: 3px solid rgba(91,106,240,.5);
  flex-shrink: 0;
}

.advisor-avatar img { width: 100%; height: 100%; object-fit: cover; }

.avatar-initials {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  margin-bottom: 20px;
  flex-shrink: 0;
}

.advisor-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--sidebar-head);
  margin-bottom: 4px;
}

.advisor-title {
  font-size: 13px;
  color: var(--brand);
  font-weight: 500;
  margin-bottom: 16px;
}

.advisor-bio {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--sidebar-text);
  opacity: .85;
  margin-bottom: 24px;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,.08);
  margin: 20px 0;
}

.sidebar-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 13px;
}

.sidebar-meta-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sidebar-text);
}

.sidebar-meta-item .icon { font-size: 15px; }

.sidebar-service-info {
  background: rgba(91,106,240,.15);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 24px;
}

.sidebar-service-info .svc-name {
  font-size: 15px;
  font-weight: 600;
  color: white;
  margin-bottom: 8px;
}

.badge-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.badge {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.badge-free  { background: rgba(16,185,129,.2); color: #6ee7b7; }
.badge-paid  { background: rgba(249,115,22,.2);  color: #fdba74; }
.badge-time  { background: rgba(255,255,255,.1);  color: rgba(255,255,255,.7); }

.sidebar-footer {
  margin-top: auto;
  padding-top: 24px;
}

.btn-whatsapp {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #25d366;
  color: white;
  border-radius: var(--radius-sm);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  width: 100%;
  transition: background var(--transition), transform var(--transition);
}

.btn-whatsapp:hover { background: #1ebe5e; transform: translateY(-1px); opacity: 1; }

.sidebar-login-link {
  display: block;
  text-align: center;
  font-size: 11px;
  color: rgba(255,255,255,.25);
  margin-top: 16px;
  transition: color var(--transition);
}

.sidebar-login-link:hover { color: rgba(255,255,255,.5); opacity: 1; }

/* ── Main Content ── */
.main-content {
  flex: 1;
  padding: 48px 48px 80px;
  overflow-y: auto;
  min-width: 0;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--sidebar-text);
  margin-bottom: 32px;
  transition: color var(--transition);
}

.back-link:hover { color: white; opacity: 1; }

/* ── Page Header ── */
.page-header {
  margin-bottom: 36px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.page-header p {
  color: var(--text-secondary);
  font-size: 15px;
}

/* ── Service Cards ── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.service-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: transform var(--transition), box-shadow var(--transition);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.svc-color-bar {
  height: 4px;
  border-radius: 4px;
  margin-bottom: 4px;
}

.svc-name {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.svc-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.svc-meta {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.svc-tag {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
}

.svc-price {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: auto;
}

.svc-price span { font-size: 12px; font-weight: 400; color: var(--text-muted); }

.btn-book {
  display: block;
  text-align: center;
  padding: 11px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  color: white;
  transition: filter var(--transition), transform var(--transition);
  width: 100%;
  border: none;
  cursor: pointer;
}

.btn-book:hover { filter: brightness(1.1); transform: translateY(-1px); opacity: 1; }

/* ── Booking Steps ── */
.booking-steps {
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 680px;
}

.step-section {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.step-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.step-num {
  width: 28px;
  height: 28px;
  background: var(--brand);
  color: white;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.step-body { padding: 24px; }

/* ── Calendar ── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.cal-nav button {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all var(--transition);
}

.cal-nav button:hover { background: var(--brand-light); color: var(--brand); border-color: var(--brand); }

.cal-month {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-day-name {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  padding: 6px 0;
}

.cal-day {
  text-align: center;
  padding: 8px 4px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all var(--transition);
  border: 1px solid transparent;
}

.calendar .day:not(.disabled):hover {
  background: rgba(102, 126, 234, 0.1);
  color: var(--brand);
}

.calendar .day.selected {
  background: var(--brand);
  color: white;
  font-weight: 500;
}

.calendar .day.has-slots {
  background: var(--brand-light);
  color: var(--brand);
  font-weight: 600;
  border-color: rgba(91,106,240,.3);
}

.calendar .day.has-slots::after {
  content: '';
  display: block;
  width: 5px;
  height: 5px;
  background: var(--brand);
  border-radius: 50%;
  margin: 3px auto 0;
}

.calendar .day.has-slots.selected::after {
  background: white;
}

.cal-day.today { font-weight: 700; color: var(--brand); }
.cal-day.disabled { color: var(--text-muted); cursor: not-allowed; opacity: .5; }
.cal-day.other-month { opacity: .3; cursor: default; }

/* ── Time Slots ── */
.slots-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 8px;
}

.time-slot {
  padding: 10px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-primary);
  background: var(--surface);
  transition: all var(--transition);
}

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

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

.slots-placeholder {
  color: var(--text-muted);
  font-size: 13px;
  padding: 16px 0;
}

/* ── Form ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--surface);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(91,106,240,.12);
}

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

/* Honeypot — oculto para humanos */
.hp-field { display: none !important; visibility: hidden; }

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

/* ── Buttons ── */
.btn-primary {
  background: var(--brand);
  color: white;
  border: none;
  padding: 13px 28px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  transition: background var(--transition), transform var(--transition), box-shadow var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-primary:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(91,106,240,.4);
}

.btn-primary:disabled {
  opacity: .6;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ── Alerts ── */
.alert {
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 20px;
  display: none;
}

.alert.show { display: flex; }
.alert-success { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.alert-error   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }
.alert-info    { background: var(--brand-light); border: 1px solid #c7d2fe; color: #312e81; }

/* ── Loader ── */
.spinner-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(30,31,59,.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.spinner-overlay.show { display: flex; }

.spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

/* ── Success/Error Pages ── */
.result-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px;
  text-align: center;
}

.result-icon { font-size: 72px; margin-bottom: 24px; }

.result-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.result-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 12px; }
.result-card p  { color: var(--text-secondary); line-height: 1.7; margin-bottom: 8px; }

/* ── 404 ── */
.not-found {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  text-align: center;
  padding: 40px;
}

.not-found h1 {
  font-size: 80px;
  font-weight: 800;
  color: var(--brand);
  line-height: 1;
  margin-bottom: 8px;
}

.not-found h2 { font-size: 22px; margin-bottom: 12px; }
.not-found p  { color: var(--text-secondary); }

/* ── Admin Login ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--sidebar-bg) 0%, #2d2f5e 100%);
  padding: 40px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  text-align: center;
  margin-bottom: 32px;
}

.login-logo h1 {
  font-size: 22px;
  font-weight: 700;
  color: var(--brand);
  margin-bottom: 4px;
}

.login-logo p { font-size: 13px; color: var(--text-muted); }

/* ── Admin Dashboard ── */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 240px;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: 28px 0;
  position: sticky;
  top: 0;
  height: 100vh;
}

.admin-logo {
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  margin-bottom: 12px;
}

.admin-logo h2 { font-size: 16px; font-weight: 700; color: white; }
.admin-logo p  { font-size: 11px; color: var(--brand); font-weight: 500; }

.admin-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  font-size: 13.5px;
  color: var(--sidebar-text);
  transition: all var(--transition);
}

.admin-nav a:hover,
.admin-nav a.active {
  background: rgba(91,106,240,.15);
  color: white;
  opacity: 1;
}

.admin-nav a .nav-icon { font-size: 16px; }

.admin-main {
  flex: 1;
  padding: 40px;
  overflow-y: auto;
  background: var(--bg);
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
}

.admin-header h1 { font-size: 22px; font-weight: 700; }

/* ── Stats Cards ── */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.stat-value { font-size: 28px; font-weight: 700; color: var(--text-primary); }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Tables ── */
.table-wrap {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table { width: 100%; border-collapse: collapse; }

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafbff; }

/* ── Status Badges ── */
.status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-CONFIRMED  { background: #ecfdf5; color: #065f46; }
.status-PENDING    { background: #fffbeb; color: #92400e; }
.status-COMPLETED  { background: #eff6ff; color: #1e40af; }
.status-CANCELLED  { background: #fef2f2; color: #991b1b; }

/* ── Link del Servicio (en admin) ── */
.link-copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.link-copy-box code { flex: 1; color: var(--brand); }

.btn-copy {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 15px;
  padding: 2px;
  transition: transform var(--transition);
}

.btn-copy:hover { transform: scale(1.2); }

/* ── Availability Grid ── */
.availability-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.avail-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.avail-day {
  width: 90px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.avail-toggle {
  width: 36px;
  height: 20px;
  position: relative;
  flex-shrink: 0;
}

.avail-toggle input { opacity: 0; width: 0; height: 0; }

.avail-toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.avail-toggle input:checked ~ .avail-toggle-track {
  background: var(--success);
}

.avail-toggle-track::after {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: white;
  transition: transform var(--transition);
}

.avail-toggle input:checked ~ .avail-toggle-track::after {
  transform: translateX(16px);
}

.avail-times {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.avail-times input[type="time"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .page-layout { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 28px 24px;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
  }

  .advisor-avatar,
  .avatar-initials { margin-bottom: 0; width: 60px; height: 60px; font-size: 20px; }

  .advisor-bio,
  .sidebar-divider,
  .sidebar-footer { display: none; }

  .main-content { padding: 24px 20px 60px; }

  .form-row { grid-template-columns: 1fr; }

  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; height: auto; position: static; padding: 16px 0; }
}
