/* ═══════════════════════════════════════
   AGENDA — CSS
   ═══════════════════════════════════════ */

/* ── Toolbar ── */
.agenda-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--sp-3); margin-bottom: var(--sp-5); flex-wrap: wrap;
}
.agenda-nav {
  display: flex; align-items: center; gap: var(--sp-2);
}
.agenda-nav-btn {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  border: var(--border-default); background: var(--neutral-900);
  color: var(--neutral-300); cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--t-fast); font-family: var(--font-body);
}
.agenda-nav-btn:hover { background: var(--neutral-800); border-color: var(--neutral-600); }
.agenda-periodo {
  font-family: var(--font-display); font-size: var(--text-md);
  font-weight: 600; color: var(--neutral-100); min-width: 200px; text-align: center;
}
.agenda-view-toggle {
  display: flex; gap: 2px; background: var(--neutral-850);
  border: var(--border-subtle); border-radius: var(--radius-md); padding: 3px;
}
.agenda-view-btn {
  padding: var(--sp-1) var(--sp-3); border-radius: var(--radius-sm);
  border: none; background: none; color: var(--neutral-500);
  font-size: var(--text-xs); font-weight: 600; font-family: var(--font-body);
  cursor: pointer; transition: all var(--t-fast); white-space: nowrap;
}
.agenda-view-btn.active { background: var(--neutral-800); color: var(--neutral-100); }

/* ── Filtro profesional ── */
.agenda-filtros {
  display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap;
}
.agenda-filtro-label { font-size: var(--text-xs); color: var(--neutral-500); white-space: nowrap; }
.agenda-prof-chip {
  display: flex; align-items: center; gap: var(--sp-1);
  padding: 3px var(--sp-3) 3px var(--sp-2);
  border-radius: var(--radius-full); border: 1px solid transparent;
  cursor: pointer; font-size: var(--text-xs); font-weight: 600;
  font-family: var(--font-body); transition: all var(--t-fast);
  background: var(--neutral-800); color: var(--neutral-300);
}
.agenda-prof-chip:hover { border-color: var(--neutral-600); }
.agenda-prof-chip.active { color: #fff; }
.agenda-prof-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ═══════════════════════════════════════
   VISTA SEMANA
   ═══════════════════════════════════════ */
.semana-wrap {
  background: var(--neutral-900); border: var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
}
.semana-header {
  display: grid; grid-template-columns: 56px repeat(7, 1fr);
  border-bottom: var(--border-subtle); background: var(--neutral-850);
}
.semana-header-cell {
  padding: var(--sp-3) var(--sp-2); text-align: center;
  border-left: var(--border-subtle);
}
.semana-header-cell:first-child { border-left: none; }
.semana-dia-nombre { font-size: 10px; font-weight: 700; color: var(--neutral-500); letter-spacing: .08em; text-transform: uppercase; }
.semana-dia-num    { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--neutral-300); line-height: 1; margin-top: 2px; }
.semana-dia-num.hoy { color: var(--brand-accent); }
.semana-header-cell.hoy { background: rgba(45,212,191,.04); }

.semana-body {
  display: grid; grid-template-columns: 56px repeat(7, 1fr);
  max-height: 600px; overflow-y: auto; position: relative;
}
.semana-horas {
  display: flex; flex-direction: column;
  border-right: var(--border-subtle);
}
.semana-hora-label {
  height: 60px; display: flex; align-items: flex-start;
  justify-content: flex-end; padding: 4px var(--sp-2) 0;
  font-size: 10px; color: var(--neutral-700); font-family: var(--font-mono);
  flex-shrink: 0;
}
.semana-col {
  border-left: var(--border-subtle); position: relative;
  min-height: 840px; /* 14 horas × 60px */
}
.semana-col.hoy { background: rgba(45,212,191,.02); }
.semana-col-hora {
  height: 60px; border-bottom: 1px solid var(--neutral-850);
  position: relative;
}
.semana-col-hora:nth-child(odd) { background: rgba(255,255,255,.005); }
/* Línea del cuarto de hora */
.semana-col-hora::after {
  content: ''; position: absolute; left: 0; right: 0;
  top: 50%; border-bottom: 1px dashed var(--neutral-850);
}

/* ── Turno en semana ── */
.turno-bloque {
  position: absolute; left: 2px; right: 2px;
  border-radius: var(--radius-sm); padding: 3px 6px;
  font-size: 10px; overflow: hidden; cursor: pointer;
  border-left: 3px solid;
  transition: filter var(--t-fast), transform var(--t-fast);
  z-index: 1;
}
.turno-bloque:hover { filter: brightness(1.15); transform: translateX(1px); z-index: 2; }
.turno-bloque-paciente { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.turno-bloque-tipo     { opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Línea de hora actual */
.hora-actual-line {
  position: absolute; left: 0; right: 0; height: 2px;
  background: var(--danger); z-index: 3; pointer-events: none;
}
.hora-actual-line::before {
  content: ''; position: absolute; left: -4px; top: -4px;
  width: 10px; height: 10px; border-radius: 50%; background: var(--danger);
}

/* ═══════════════════════════════════════
   VISTA DÍA
   ═══════════════════════════════════════ */
.dia-wrap {
  background: var(--neutral-900); border: var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
}
.dia-header {
  padding: var(--sp-4) var(--sp-5); border-bottom: var(--border-subtle);
  background: var(--neutral-850); display: flex; align-items: center; justify-content: space-between;
}
.dia-header-fecha { font-family: var(--font-display); font-size: var(--text-md); color: var(--neutral-100); }
.dia-header-count { font-size: var(--text-xs); color: var(--neutral-500); }
.dia-body { display: grid; grid-template-columns: 56px 1fr; max-height: 640px; overflow-y: auto; }
.dia-col  { position: relative; min-height: 840px; }

/* ═══════════════════════════════════════
   VISTA MES
   ═══════════════════════════════════════ */
.mes-wrap {
  background: var(--neutral-900); border: var(--border-subtle);
  border-radius: var(--radius-lg); overflow: hidden;
}
.mes-header-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  background: var(--neutral-850); border-bottom: var(--border-subtle);
}
.mes-dia-header {
  padding: var(--sp-2); text-align: center;
  font-size: 10px; font-weight: 700; color: var(--neutral-500);
  letter-spacing: .1em; text-transform: uppercase;
  border-left: var(--border-subtle);
}
.mes-dia-header:first-child { border-left: none; }
.mes-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.mes-celda {
  min-height: 100px; border-left: var(--border-subtle); border-top: var(--border-subtle);
  padding: var(--sp-2); cursor: pointer; transition: background var(--t-fast);
  position: relative;
}
.mes-celda:nth-child(7n+1) { border-left: none; }
.mes-celda:hover { background: var(--neutral-850); }
.mes-celda.hoy { background: rgba(45,212,191,.04); }
.mes-celda.otro-mes { opacity: .35; }
.mes-celda-num {
  font-size: var(--text-xs); font-weight: 700; color: var(--neutral-400);
  margin-bottom: var(--sp-1); display: flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
}
.mes-celda.hoy .mes-celda-num { background: var(--brand-accent); color: var(--neutral-950); }
.mes-turno-pill {
  display: flex; align-items: center; gap: 3px;
  padding: 1px 5px; border-radius: 3px; margin-bottom: 2px;
  font-size: 9px; font-weight: 600; cursor: pointer;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: filter var(--t-fast);
}
.mes-turno-pill:hover { filter: brightness(1.2); }
.mes-turno-mas {
  font-size: 9px; color: var(--neutral-500); padding: 1px 4px;
  cursor: pointer;
}
.mes-turno-mas:hover { color: var(--brand-accent); }

/* ═══════════════════════════════════════
   DRAWER TURNO
   ═══════════════════════════════════════ */
.turno-drawer-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 100; animation: fadeIn .15s ease both;
}
.turno-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 520px; max-width: 95vw;
  background: var(--neutral-900); border-left: var(--border-default);
  display: flex; flex-direction: column; z-index: 101;
  animation: slideInRight .22s ease both;
  box-shadow: -12px 0 60px rgba(0,0,0,.6);
}

/* ── Estado chips ── */
.estado-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: var(--radius-full);
  font-size: 10px; font-weight: 700; letter-spacing: .06em; cursor: pointer;
  border: 1px solid transparent; transition: all var(--t-fast);
}
.estado-confirmado  { background: rgba(34,197,94,.12);  color: var(--success);  border-color: rgba(34,197,94,.3); }
.estado-pendiente   { background: rgba(245,158,11,.12); color: var(--warning);  border-color: rgba(245,158,11,.3); }
.estado-en_curso    { background: rgba(56,189,248,.12); color: var(--info);     border-color: rgba(56,189,248,.3); }
.estado-finalizado  { background: rgba(90,120,115,.2);  color: var(--neutral-400); }
.estado-cancelado   { background: rgba(244,63,94,.12);  color: var(--danger);   border-color: rgba(244,63,94,.3); }
.estado-no_asistio  { background: rgba(244,63,94,.08);  color: var(--neutral-500); }

/* ── Turno detalle card ── */
.turno-detalle-header {
  display: flex; gap: var(--sp-4); align-items: flex-start;
  padding: var(--sp-5); background: var(--neutral-850);
  border-bottom: var(--border-subtle);
}
.turno-tipo-icon {
  width: 44px; height: 44px; border-radius: var(--radius-lg);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.turno-detalle-info { flex: 1; }
.turno-detalle-titulo { font-family: var(--font-display); font-size: var(--text-md); color: var(--neutral-50); margin-bottom: var(--sp-1); }
.turno-detalle-meta  { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.turno-detalle-tag   { font-size: var(--text-xs); color: var(--neutral-400); display: flex; align-items: center; gap: 4px; }

/* ── Mini calendario para el datepicker ── */
.mini-cal {
  background: var(--neutral-850); border: var(--border-default);
  border-radius: var(--radius-lg); padding: var(--sp-3);
  display: none; position: absolute; z-index: 50;
  box-shadow: var(--shadow-lg); top: 100%; left: 0; margin-top: 4px;
}
.mini-cal.open { display: block; }
.mini-cal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: var(--sp-3);
}
.mini-cal-nav { background: none; border: none; color: var(--neutral-400); cursor: pointer; font-size: 14px; padding: 2px 6px; border-radius: var(--radius-sm); transition: all var(--t-fast); }
.mini-cal-nav:hover { background: var(--neutral-800); color: var(--neutral-200); }
.mini-cal-titulo { font-size: var(--text-xs); font-weight: 700; color: var(--neutral-200); }
.mini-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.mini-cal-dia-header { font-size: 9px; color: var(--neutral-600); text-align: center; font-weight: 700; letter-spacing: .06em; padding: 2px; }
.mini-cal-dia {
  width: 28px; height: 28px; border-radius: var(--radius-sm); border: none;
  background: none; color: var(--neutral-400); font-size: 11px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-family: var(--font-body); transition: all var(--t-fast);
}
.mini-cal-dia:hover { background: var(--neutral-800); color: var(--neutral-200); }
.mini-cal-dia.hoy    { color: var(--brand-accent); font-weight: 700; }
.mini-cal-dia.sel    { background: var(--brand-primary); color: #fff; }
.mini-cal-dia.otro-mes { opacity: .3; }

/* ── Drag & Drop ─────────────────────────────────────────────── */
.semana-col.drop-target {
  background: var(--neutral-850);
}
.semana-col.drop-over {
  background: color-mix(in srgb, var(--brand-accent) 8%, transparent);
  outline: 1px dashed var(--brand-accent);
  outline-offset: -2px;
}
.turno-bloque[draggable="true"] {
  cursor: grab;
}
.turno-bloque[draggable="true"]:active {
  cursor: grabbing;
}
