/* ── APP.CSS — Citas App (Client) ─────────────────────────────────────────── */

/* Config variables — personalizar por cliente */
:root {
  --brand-primary: #2C5F4A;   /* verde bosque */
  --brand-secondary: #8FAE8B; /* verde sage */
  --brand-accent: #D4A853;    /* dorado cálido */
  --brand-light: #F5F0E8;     /* crema */
  --brand-dark: #1A2E22;

  --text-primary: #1A1A1A;
  --text-secondary: #5C5C5C;
  --text-muted: #9A9A9A;

  --bg-main: #F9F6F0;
  --bg-card: #FFFFFF;
  --bg-sidebar: var(--brand-dark);

  --border: #E8E2D9;
  --border-focus: var(--brand-primary);

  --success: #2C7A4B;
  --success-bg: #EBF7EF;
  --error: #C0392B;
  --error-bg: #FDECEA;
  --warning: #D4A853;
  --warning-bg: #FDF6E3;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.12);

  --sidebar-w: 240px;
  --header-h: 64px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'DM Sans', system-ui, sans-serif;
  --transition: 0.18s ease;
}

/* ── RESET ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font-body); background: var(--bg-main); color: var(--text-primary); line-height: 1.6; }
a { color: var(--brand-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
input, select, textarea, button { font-family: inherit; }

/* ── SCREENS ─────────────────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }
.hidden { display: none !important; }

/* ── AUTH ────────────────────────────────────────────────────────────────── */
.auth-split {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

.auth-brand {
  flex: 0 0 42%;
  background: var(--brand-dark);
  color: white;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 40px;
  position: relative;
  overflow: hidden;
}

.auth-brand::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 20% 80%, rgba(44,95,74,0.6) 0%, transparent 50%),
    radial-gradient(circle at 80% 20%, rgba(212,168,83,0.3) 0%, transparent 50%);
}

.brand-logo {
  font-size: 64px;
  margin-bottom: 24px;
  position: relative;
}

.brand-name {
  font-family: var(--font-display);
  font-size: 2.4rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  position: relative;
  text-align: center;
}

.brand-tagline {
  margin-top: 12px;
  color: rgba(255,255,255,0.6);
  font-size: 1rem;
  font-weight: 300;
  position: relative;
  text-align: center;
}

.auth-forms {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px 56px;
  max-width: 520px;
  margin: 0 auto;
}

.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-main);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 28px;
}

.tab-btn {
  flex: 1;
  padding: 10px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.tab-btn.active {
  background: white;
  color: var(--brand-primary);
  font-weight: 600;
  box-shadow: var(--shadow);
}

/* ── FORMS ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.hint { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: white;
  transition: var(--transition);
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(44,95,74,0.1);
}

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

.input-with-icon { position: relative; }
.input-with-icon input { padding-right: 44px; }
.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0.5;
  padding: 4px;
}
.toggle-password:hover { opacity: 1; }

/* ── BUTTONS ─────────────────────────────────────────────────────────────── */
.btn-primary {
  background: var(--brand-primary);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary:hover { background: var(--brand-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; margin-top: 4px; }

.btn-secondary {
  background: white;
  color: var(--brand-primary);
  border: 1.5px solid var(--border);
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { border-color: var(--brand-primary); background: var(--brand-light); }

.btn-danger {
  background: white;
  color: var(--error);
  border: 1.5px solid var(--error);
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.btn-danger:hover { background: var(--error-bg); }

.btn-link {
  background: none;
  border: none;
  color: var(--brand-primary);
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 0;
}

.btn-back {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: var(--transition);
}
.btn-back:hover { color: var(--brand-primary); }

.btn-forgot { display: block; margin-top: 12px; }

/* ── ALERTS ───────────────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  margin-bottom: 16px;
}
.alert-error { background: var(--error-bg); color: var(--error); border: 1px solid rgba(192,57,43,0.2); }
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(44,122,75,0.2); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(212,168,83,0.2); }

/* ── CONSENT ─────────────────────────────────────────────────────────────── */
.consent-group { margin: 20px 0; display: flex; flex-direction: column; gap: 12px; }
.consent-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  line-height: 1.5;
}
.consent-label input[type="checkbox"] { margin-top: 2px; accent-color: var(--brand-primary); }
.consent-label.optional { color: var(--text-muted); }

/* ── UNVERIFIED PANEL ────────────────────────────────────────────────────── */
.unverified-panel {
  background: var(--warning-bg);
  border: 1px solid rgba(212,168,83,0.3);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 0.875rem;
}

/* ── CENTERED CARD (verify, reset) ─────────────────────────────────────────── */
.centered-card {
  background: white;
  border-radius: var(--radius);
  padding: 48px;
  box-shadow: var(--shadow-md);
  max-width: 460px;
  width: 100%;
  margin: auto;
  text-align: center;
}

#screen-verify, #screen-reset {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg-main);
}
#screen-verify.active, #screen-reset.active { display: flex; }

.verify-state { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.verify-icon {
  width: 64px; height: 64px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700;
}
.verify-icon.success { background: var(--success-bg); color: var(--success); }
.verify-icon.error { background: var(--error-bg); color: var(--error); }

.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--brand-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── APP LAYOUT ──────────────────────────────────────────────────────────── */
#screen-app { display: none; flex-direction: row; }
#screen-app.active { display: flex; }

.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  color: white;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
}

.sidebar-brand {
  padding: 24px 20px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo { font-size: 24px; }
.sidebar-name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: white;
}

.sidebar-nav {
  list-style: none;
  padding: 16px 12px;
  flex: 1;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255,255,255,0.65);
  font-size: 0.9rem;
  font-weight: 400;
  transition: var(--transition);
  margin-bottom: 2px;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.1);
  color: white;
  text-decoration: none;
}
.nav-item.active { font-weight: 600; }
.nav-icon { font-size: 1.1rem; width: 22px; text-align: center; }

.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.btn-logout {
  width: 100%;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  padding: 9px;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-logout:hover { border-color: rgba(255,255,255,0.5); color: white; }

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

.app-header {
  height: var(--header-h);
  background: white;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 32px;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-secondary);
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  flex: 1;
}

.header-user { color: var(--text-muted); font-size: 0.875rem; }

/* ── VIEWS ───────────────────────────────────────────────────────────────── */
.view { padding: 32px; display: none; }
.view.active { display: block; }
.view-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }

/* ── BOOKING FLOW ─────────────────────────────────────────────────────────── */
.booking-flow { max-width: 640px; }
.booking-step { background: white; border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); margin-bottom: 16px; }
.step-title { font-family: var(--font-display); font-size: 1.15rem; margin-bottom: 20px; display: flex; align-items: center; gap: 10px; }
.step-num {
  width: 28px; height: 28px;
  background: var(--brand-primary);
  color: white;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; font-weight: 700; font-family: var(--font-body);
}
.step-subtitle { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 16px; }

/* Cards grid */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }

.professional-card {
  background: white;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.professional-card:hover, .professional-card.selected {
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(44,95,74,0.1);
}
.prof-avatar { font-size: 36px; margin-bottom: 8px; }
.prof-name { font-weight: 600; font-size: 0.95rem; }
.prof-spec { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }

/* Calendar */
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  font-weight: 600;
}
.cal-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 14px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: var(--transition);
}
.cal-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-day-label {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 6px 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.cal-day {
  aspect-ratio: 1;
  border: none;
  background: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.cal-day:hover:not(:disabled) { background: var(--brand-light); }
.cal-day.selected { background: var(--brand-primary); color: white; font-weight: 600; }
.cal-day.today { font-weight: 700; color: var(--brand-primary); }
.cal-day:disabled { color: var(--text-muted); cursor: default; opacity: 0.4; }
.cal-day.empty { cursor: default; }

/* Slots */
.slots-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-btn {
  padding: 9px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: white;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.slot-btn:hover { border-color: var(--brand-primary); color: var(--brand-primary); }
.slot-btn.selected { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }

/* Booking summary */
.booking-summary {
  background: var(--bg-main);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin-bottom: 20px;
}
.booking-summary p { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.booking-summary p:last-child { border: none; }
.booking-summary strong { color: var(--text-primary); }

/* Booking success */
.booking-success { text-align: center; padding: 16px 0; }
.success-icon {
  width: 64px; height: 64px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px;
  margin: 0 auto 16px;
}
.booking-success h3 { font-family: var(--font-display); font-size: 1.5rem; margin-bottom: 8px; }
.booking-success p { color: var(--text-muted); margin-bottom: 24px; }
.booking-success .btn-primary { margin-bottom: 8px; }

/* ── APPOINTMENTS LIST ───────────────────────────────────────────────────── */
.appointments-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }

.appt-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 20px;
  transition: var(--transition);
}
.appt-card:hover { box-shadow: var(--shadow-md); }

.appt-date-block {
  text-align: center;
  min-width: 56px;
}
.appt-day { font-size: 1.8rem; font-weight: 700; color: var(--brand-primary); line-height: 1; }
.appt-month { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }

.appt-info { flex: 1; }
.appt-name { font-weight: 600; font-size: 0.95rem; }
.appt-detail { color: var(--text-muted); font-size: 0.85rem; margin-top: 2px; }

.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-confirmed { background: var(--success-bg); color: var(--success); }
.badge-completed { background: #EEF2FF; color: #4F46E5; }
.badge-cancelled { background: #FFF0F0; color: var(--error); }

.appt-actions { display: flex; gap: 8px; }
.btn-icon {
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon:hover { border-color: var(--error); color: var(--error); }

/* Filter tabs */
.filter-tabs { display: flex; gap: 6px; }
.filter-btn {
  padding: 7px 14px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  background: white;
  font-size: 0.85rem;
  cursor: pointer;
  transition: var(--transition);
}
.filter-btn.active { background: var(--brand-primary); border-color: var(--brand-primary); color: white; }

/* ── PETS ────────────────────────────────────────────────────────────────── */
.pet-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  position: relative;
  transition: var(--transition);
}
.pet-card:hover { box-shadow: var(--shadow-md); }
.pet-emoji { font-size: 32px; margin-bottom: 8px; }
.pet-name { font-weight: 700; font-size: 1rem; }
.pet-detail { color: var(--text-muted); font-size: 0.8rem; margin-top: 4px; }
.pet-actions { display: flex; gap: 6px; margin-top: 14px; }
.pet-actions .btn-icon { font-size: 0.8rem; }

/* ── MODAL ───────────────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; }
.modal-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); }
.modal-box {
  background: white;
  border-radius: var(--radius);
  padding: 32px;
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-md);
}
.modal-box h3 { font-family: var(--font-display); font-size: 1.3rem; margin-bottom: 24px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }

/* ── HISTORY ─────────────────────────────────────────────────────────────── */
.select-inline { padding: 8px 12px; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: 0.9rem; }
.history-list { display: flex; flex-direction: column; gap: 12px; max-width: 720px; }
.history-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px 24px;
  box-shadow: var(--shadow);
}
.history-date { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 8px; }
.history-field { display: flex; gap: 8px; margin-bottom: 4px; font-size: 0.9rem; }
.history-label { color: var(--text-muted); min-width: 100px; }

/* ── PROFILE ─────────────────────────────────────────────────────────────── */
.profile-sections { max-width: 640px; display: flex; flex-direction: column; gap: 24px; }
.profile-section {
  background: white;
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
}
.profile-section h3 { font-family: var(--font-display); font-size: 1.1rem; margin-bottom: 20px; }
.profile-section .btn-primary { margin-top: 8px; }
.profile-section--danger { border: 1.5px solid rgba(192,57,43,0.15); }
.text-muted { color: var(--text-muted); font-size: 0.875rem; margin-bottom: 16px; }
.danger-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ── EMPTY STATES ────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 0.95rem; }

/* ── LOADING ─────────────────────────────────────────────────────────────── */
.loading-row {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; padding: 32px; color: var(--text-muted);
}

/* ── RESPONSIVE ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .auth-split { flex-direction: column; }
  .auth-brand { flex: 0 0 auto; padding: 40px 24px; min-height: 200px; }
  .auth-forms { padding: 32px 24px; }

  .sidebar {
    position: fixed;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    z-index: 150;
  }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu-btn { display: flex; }

  .app-main { width: 100vw; }
  .view { padding: 20px 16px; }
  .form-row { grid-template-columns: 1fr; }
  .appt-card { flex-wrap: wrap; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

@media (max-width: 480px) {
  .auth-forms { padding: 24px 20px; }
  .booking-step { padding: 20px; }
  .modal-box { padding: 24px 20px; }
}
