/* ClinicApp — Sistema de diseño
   Tipografía: Inter
   Color: teal médico — primary #0f766e, accent #14b8a6
   Base: Bootstrap 5.3 + tokens propios */

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

:root {
  --c-bg:            #fafaf9;
  --c-surface:       #ffffff;
  --c-surface-2:     #f5f5f4;
  --c-border:        #e7e5e4;
  --c-border-strong: #d6d3d1;

  --c-text:          #1c1917;
  --c-text-muted:    #57534e;
  --c-text-subtle:   #78716c;

  --c-primary:       #0f766e;
  --c-primary-hover: #115e59;
  --c-primary-soft:  #ccfbf1;
  --c-primary-soft-2:#f0fdfa;
  --c-accent:        #14b8a6;

  --c-success:       #16a34a;
  --c-success-soft:  #dcfce7;
  --c-warning:       #d97706;
  --c-warning-soft:  #fef3c7;
  --c-danger:        #dc2626;
  --c-danger-soft:   #fee2e2;
  --c-info:          #2563eb;
  --c-info-soft:     #dbeafe;

  --c-st-confirmed:    #0f766e;
  --c-st-confirmed-bg: #ccfbf1;
  --c-st-pending:      #d97706;
  --c-st-pending-bg:   #fef3c7;
  --c-st-cancelled:    #b91c1c;
  --c-st-cancelled-bg: #fee2e2;
  --c-st-completed:    #475569;
  --c-st-completed-bg: #e2e8f0;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --r-sm: 6px; --r-md: 8px; --r-lg: 12px; --r-xl: 16px;
  --shadow-xs: 0 1px 2px rgba(15,23,42,.04);
  --shadow-sm: 0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.06), 0 2px 4px rgba(15,23,42,.04);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.08), 0 4px 12px rgba(15,23,42,.04);
}

/* ── Reset / base ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: 100%; margin: 0;
  font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--c-text); background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

/* ── Bootstrap primary overrides ─────────────────────── */
.btn-primary            { background-color: var(--c-primary) !important; border-color: var(--c-primary) !important; }
.btn-primary:hover      { background-color: var(--c-primary-hover) !important; border-color: var(--c-primary-hover) !important; }
.btn-outline-primary    { color: var(--c-primary) !important; border-color: var(--c-primary) !important; }
.btn-outline-primary:hover { background-color: var(--c-primary) !important; color: #fff !important; }
a { color: var(--c-primary); }
a:hover { color: var(--c-primary-hover); }
.form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }

/* ── Layout shell ─────────────────────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }
.app-body  { flex: 1; display: flex; flex-direction: column; min-width: 0; height: 100%; overflow: hidden; }

/* ── Sidebar ──────────────────────────────────────────── */
#sidebar {
  width: 240px;
  background: var(--c-surface);
  border-right: 1px solid var(--c-border);
  display: flex; flex-direction: column;
  flex-shrink: 0; height: 100%; overflow-y: auto;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--c-border);
  text-decoration: none; color: var(--c-text);
}
.sidebar-brand:hover { color: var(--c-text); }
.sidebar-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--c-primary), var(--c-accent));
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 16px; flex-shrink: 0;
}
.sidebar-brand-name { font-weight: 600; font-size: 15px; letter-spacing: -0.2px; line-height: 1.2; }
.sidebar-brand-sub  { font-size: 11px; color: var(--c-text-subtle); }
.sidebar-nav { padding: 12px 10px; flex: 1; }
.nav-section {
  font-size: 11px; font-weight: 600; letter-spacing: 0.5px;
  text-transform: uppercase; color: var(--c-text-subtle);
  padding: 14px 10px 6px;
}
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 6px;
  color: var(--c-text-muted); font-size: 13.5px; font-weight: 500;
  text-decoration: none; transition: background 0.12s, color 0.12s; line-height: 1.4;
}
.nav-link:hover { background: var(--c-surface-2); color: var(--c-text); }
.nav-link.active { background: var(--c-primary-soft-2); color: var(--c-primary); }
.nav-link i { font-size: 16px; width: 18px; text-align: center; color: var(--c-text-subtle); }
.nav-link.active i { color: var(--c-primary); }
.sidebar-footer {
  border-top: 1px solid var(--c-border); padding: 12px;
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
}
.sidebar-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c-primary-soft); color: var(--c-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12px; flex-shrink: 0;
}
.sidebar-user-name { font-size: 13px; font-weight: 600; line-height: 1.2; }
.sidebar-user-role { font-size: 11px; color: var(--c-text-subtle); }

/* ── Topbar ───────────────────────────────────────────── */
#topbar {
  height: 56px;
  background: var(--c-surface); border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; padding: 0 20px; gap: 16px; flex-shrink: 0;
}
.page-title { font-size: 17px; font-weight: 600; margin: 0; letter-spacing: -0.2px; }

/* ── Main content ─────────────────────────────────────── */
#main-content { flex: 1; overflow-y: auto; padding: 24px; background: var(--c-bg); }

/* ── KPI tiles ────────────────────────────────────────── */
.kpi { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); padding: 16px 18px; }
.kpi-label { font-size: 12px; color: var(--c-text-subtle); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 600; letter-spacing: -0.6px; margin-top: 4px; color: var(--c-text); }
.kpi-delta { font-size: 11.5px; margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.kpi-delta.up   { color: var(--c-success); }
.kpi-delta.down { color: var(--c-danger); }
.kpi-icon {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--c-primary-soft-2); color: var(--c-primary);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}

/* ── Cards ────────────────────────────────────────────── */
.card-clinic { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; }
.card-clinic-h {
  padding: 14px 18px; border-bottom: 1px solid var(--c-border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-clinic-h h3 { font-size: 14px; font-weight: 600; margin: 0; }
.card { border-color: var(--c-border); border-radius: var(--r-lg); }
.card-header { background: var(--c-surface) !important; border-color: var(--c-border); }
.card-footer { background: var(--c-surface) !important; border-color: var(--c-border); }

/* ── Status pills ─────────────────────────────────────── */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11.5px; font-weight: 500; line-height: 1.5;
}
.pill::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0; }

.badge-scheduled { color: var(--c-st-confirmed);  background: var(--c-st-confirmed-bg); display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 12px; font-size: 11.5px; font-weight: 500; }
.badge-completed  { color: var(--c-st-completed);  background: var(--c-st-completed-bg); display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 12px; font-size: 11.5px; font-weight: 500; }
.badge-cancelled  { color: var(--c-st-cancelled);  background: var(--c-st-cancelled-bg); display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 12px; font-size: 11.5px; font-weight: 500; }
.badge-no_show    { color: var(--c-text-subtle);   background: var(--c-surface-2);       display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 12px; font-size: 11.5px; font-weight: 500; }

/* dot before each badge */
.badge-scheduled::before, .badge-completed::before, .badge-cancelled::before, .badge-no_show::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}

/* ── Tables ───────────────────────────────────────────── */
.table { font-size: 13px; }
.table > thead > tr > th {
  font-size: 11.5px; font-weight: 500; color: var(--c-text-subtle);
  letter-spacing: 0.3px; text-transform: uppercase;
  background: var(--c-surface-2); border-color: var(--c-border); padding: 12px 14px;
}
.table > tbody > tr > td { padding: 12px 14px; border-color: var(--c-border); vertical-align: middle; color: var(--c-text); }
.table-hover tbody tr:hover > td { background: var(--c-surface-2); }
.table-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--r-lg); overflow: hidden; }

/* ── Forms ────────────────────────────────────────────── */
.form-control, .form-select {
  border-color: var(--c-border-strong); border-radius: var(--r-md);
  font-size: 13px; font-family: var(--font); color: var(--c-text); background: var(--c-surface);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgba(15,118,110,.12);
}
.form-label { font-size: 12px; font-weight: 500; color: var(--c-text-muted); margin-bottom: 5px; }
.btn { font-family: var(--font); border-radius: var(--r-md); font-size: 13px; font-weight: 500; }
.btn-sm { font-size: 12px; padding: 5px 10px; }
.alert { border-radius: var(--r-lg); font-size: 13.5px; border: none; }
.alert-success { background: var(--c-success-soft); color: var(--c-success); }
.alert-danger  { background: var(--c-danger-soft);  color: var(--c-danger); }

/* ── FullCalendar overrides ───────────────────────────── */
.fc .fc-toolbar-title { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.fc .fc-button-primary { background: var(--c-primary) !important; border-color: var(--c-primary) !important; border-radius: var(--r-sm) !important; font-size: 13px !important; font-weight: 500 !important; }
.fc .fc-button-primary:hover { background: var(--c-primary-hover) !important; }
.fc .fc-button-primary:not(.fc-button-active) { background: var(--c-surface) !important; border-color: var(--c-border-strong) !important; color: var(--c-text) !important; }
.fc .fc-button-primary:not(.fc-button-active):hover { background: var(--c-surface-2) !important; }
.fc .fc-button-active { background: var(--c-primary) !important; color: white !important; }
.fc-theme-standard td, .fc-theme-standard th { border-color: var(--c-border); }
.fc .fc-timegrid-slot { height: 48px; }
.fc .fc-col-header-cell-cushion { font-weight: 600; color: var(--c-text); }
.fc .fc-day-today { background: var(--c-primary-soft-2) !important; }
.fc-event { border-radius: 6px !important; border: none !important; font-size: 11.5px !important; padding: 2px 4px !important; }
.fc-event .fc-event-main { color: white !important; }
.fc-event .fc-event-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-event .fc-event-time { font-size: 10px; opacity: .85; }
.fc-timegrid-event { border-left: 3px solid rgba(0,0,0,.15) !important; }
.status-cancelled { opacity: .55 !important; }
.status-cancelled .fc-event-title { text-decoration: line-through; }
.status-completed { opacity: .7 !important; }
.status-no_show   { opacity: .4 !important; }

/* ── Login split-screen ───────────────────────────────── */
.login-shell { display: flex; min-height: 100vh; background: var(--c-bg); }
.login-panel-left {
  flex: 0 0 50%;
  background: linear-gradient(135deg, #0f766e 0%, #115e59 100%);
  display: flex; flex-direction: column;
  padding: 48px; color: white;
  position: relative; overflow: hidden;
}
.login-deco-1 { position: absolute; top: -120px; right: -120px; width: 380px; height: 380px; border-radius: 50%; background: rgba(20,184,166,.15); }
.login-deco-2 { position: absolute; bottom: -80px; left: -80px; width: 280px; height: 280px; border-radius: 50%; background: rgba(255,255,255,.05); }
.login-panel-right { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px; }
.login-form-box { width: 100%; max-width: 360px; }
/* ── Live update badge ───────────────────────────────────── */
.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 500; color: var(--c-success);
  vertical-align: middle;
}
.live-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--c-success); flex-shrink: 0;
  animation: pulse-live 2.5s ease-in-out infinite;
}
@keyframes pulse-live {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .35; transform: scale(.75); }
}

/* ── Sidebar overlay ──────────────────────────────────────── */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.4); z-index: 1040;
}
.sidebar-overlay.open { display: block; }

/* ── Hamburger ────────────────────────────────────────────── */
.hamburger-btn { display: none; }

/* ── Calendar 80/20 layout ───────────────────────────────── */
.calendar-shell  { display: flex; gap: 16px; align-items: flex-start; }
.calendar-main   { flex: 1; min-width: 0; }
.calendar-sidebar {
  flex: 0 0 260px; width: 260px;
  overflow-y: auto; max-height: calc(100vh - 130px);
}

/* ── Mobile ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .hamburger-btn { display: flex !important; }

  #sidebar {
    position: fixed; top: 0; left: 0; height: 100%;
    z-index: 1050; transform: translateX(-100%);
    transition: transform 0.25s ease; box-shadow: var(--shadow-lg);
  }
  #sidebar.open { transform: translateX(0); }

  .app-shell { display: block; }
  .app-body  { height: 100dvh; }
  #main-content { padding: 16px; }

  .calendar-shell  { flex-direction: column; }
  .calendar-sidebar { width: 100%; max-height: none; flex: none; }

  .table-card { overflow-x: auto; }
  .table      { min-width: 520px; }

  .login-panel-left { display: none; }
  .login-panel-right { padding: 32px 20px; }
}
