/* ============================================
   CALENDAR.CSS — Vistas Mes / Semana / Día
   ============================================ */

/* ── Barra de navegación ─────────────────── */
.calendar-nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-card);
  border-radius: var(--r-xl);
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
}
.calendar-nav-btn {
  background: var(--bg-primary);
  border: 1.5px solid var(--border);
  border-radius: var(--r-md);
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--text-secondary);
  transition: all var(--t-fast);
}
.calendar-nav-btn:hover { background: var(--primary-bg); color: var(--primary); border-color: var(--primary); }
.calendar-month-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.calendar-today-btn {
  font-size: 11px; font-weight: 600; color: var(--primary);
  background: var(--primary-bg); border: none;
  border-radius: var(--r-sm); padding: 3px 10px;
  cursor: pointer; margin-top: 3px;
  transition: all var(--t-fast);
}
.calendar-today-btn:hover { background: var(--primary); color: white; }

/* ── View Toggle ─────────────────────────── */
.view-toggle { display: flex; background: var(--bg-primary); border-radius: var(--r-pill); padding: 3px; gap: 2px; border: 1.5px solid var(--border); }
.view-toggle-btn {
  padding: 5px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: none; background: transparent; color: var(--text-muted); cursor: pointer;
  transition: all var(--t-fast);
}
.view-toggle-btn.active { background: var(--primary); color: white; box-shadow: 0 2px 8px var(--primary-glow); }

/* ════════════════════════════════════════════
   VISTA MES
   ════════════════════════════════════════════ */
.cal-month-wrapper {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 14px;
  align-items: start;
}
@media (max-width: 720px) { .cal-month-wrapper { grid-template-columns: 1fr; } }

/* Grid de días */
.cal-month-grid {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
/* Grid unificado: headers + celdas en el mismo grid → alineación perfecta */
.cal-unified-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}
.cal-week-name {
  text-align: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted);
  padding: 8px 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--separator);
  background: var(--bg-card);
}
.cal-day-cell {
  height: 96px;               /* altura fija igual para todos los días */
  overflow: hidden;            /* recorta contenido extra */
  border-right: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
  padding: 6px 6px 4px;
  cursor: pointer;
  transition: background var(--t-fast);
  position: relative;
  text-align: center;
  box-sizing: border-box;
}
.cal-day-cell:nth-child(7n) { border-right: none; }
.cal-day-cell:hover { background: var(--bg-secondary); }
.cal-day-cell.other-month { opacity: 0.35; }
.cal-day-cell.today { background: color-mix(in srgb, var(--primary) 5%, transparent); }
.cal-day-cell.selected { background: var(--primary-bg); }
.cal-day-num {
  font-size: 12px; font-weight: 700;
  color: var(--text-secondary);
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  margin: 0 auto 4px;
  flex-shrink: 0;
}
.cal-day-cell.today .cal-day-num { background: var(--primary); color: white; }
.cal-day-cell.selected .cal-day-num { border: 2px solid var(--primary); color: var(--primary); }
.cal-day-events {
  display: flex; flex-direction: column; gap: 2px;
  overflow: hidden;
  max-height: 52px;            /* limita el área de eventos */
}

/* Pills de estado en mes */
.cal-pill {
  font-size: 10px; font-weight: 500;
  padding: 2px 5px 2px 4px;
  border-radius: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
  display: flex; align-items: center; gap: 4px;
  line-height: 1.4;
}

/* Puntito de color */
.cal-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

/* ── Próximo (futuro) → azul */
.cal-pill-upcoming {
  background: rgba(0,122,255,0.12);
  color: var(--primary);
  border-left: 2px solid var(--primary);
}
.cal-dot-upcoming { background: var(--primary); }

/* ── Hoy / en proceso → naranja/ámbar */
.cal-pill-today {
  background: rgba(255,149,0,0.13);
  color: #c97100;
  border-left: 2px solid #ff9500;
}
.cal-dot-today { background: #ff9500; }

/* ── Caducado (pasado) → rojo apagado */
.cal-pill-past {
  background: rgba(255,59,48,0.10);
  color: #c0392b;
  border-left: 2px solid rgba(255,59,48,0.5);
}
.cal-dot-past { background: rgba(255,59,48,0.6); }

.cal-pill-more { font-size: 10px; color: var(--text-muted); font-weight: 600; padding: 1px 4px; }

/* Sidebar del mes */
.cal-month-sidebar { display: flex; flex-direction: column; gap: 12px; }

/* Mini calendario */
.cal-mini {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  padding: 14px;
  box-shadow: var(--shadow-xs);
}
.cal-mini-header {
  font-size: 13px; font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px; text-align: center;
}
.cal-mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-mini-hd {
  text-align: center; font-size: 10px; font-weight: 700;
  color: var(--text-muted); padding: 3px 0;
  text-transform: uppercase;
}
.cal-mini-day {
  text-align: center; font-size: 11px; font-weight: 500;
  color: var(--text-secondary);
  border-radius: 50%; padding: 3px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  aspect-ratio: 1;
  transition: all var(--t-fast);
}
.cal-mini-day:hover { background: var(--primary-bg); color: var(--primary); }
.cal-mini-day.today { background: var(--primary); color: white; font-weight: 700; }

/* Panel agenda del día (en sidebar de mes) */
.cal-agenda-panel {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  padding: 14px;
  box-shadow: var(--shadow-xs);
  flex: 1;
}
.cal-agenda-title {
  font-size: 12px; font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 10px;
}
.cal-agenda-list { display: flex; flex-direction: column; gap: 4px; }
.cal-agenda-item {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 5px 8px;
  border-left: 3px solid var(--primary);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--bg-primary);
  font-size: 12px;
}
.cal-agenda-time { color: var(--text-muted); font-weight: 600; flex-shrink: 0; white-space: nowrap; }
.cal-agenda-name { color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ════════════════════════════════════════════
   VISTA SEMANA
   ════════════════════════════════════════════ */
.cal-week-wrapper {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.cal-week-head {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1.5px solid var(--separator);
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-card);
}
.cal-time-gutter { width: 52px; flex-shrink: 0; }
.cal-week-day-head {
  padding: 10px 4px;
  text-align: center;
  border-left: 1px solid var(--separator);
}
.cal-week-day-head.today { background: color-mix(in srgb, var(--primary) 6%, transparent); }
.cal-week-day-name { font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.cal-week-day-num {
  width: 30px; height: 30px; border-radius: 50%;
  font-size: 15px; font-weight: 700;
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  margin: 4px auto 0;
}
.cal-week-day-num.today { background: var(--primary); color: white; }

.cal-week-body { overflow: hidden; }
.cal-week-scroll { overflow-y: auto; max-height: 560px; }
.cal-time-row {
  display: grid;
  grid-template-columns: 52px repeat(7, 1fr);
  border-bottom: 1px solid var(--separator);
  min-height: 52px;
}
.cal-time-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  padding: 6px 6px 0;
  text-align: right;
  align-self: start;
}
.cal-week-cell {
  border-left: 1px solid var(--separator);
  padding: 3px 4px;
  min-height: 52px;
  position: relative;
  transition: background var(--t-fast);
}
.cal-week-cell.today { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.cal-week-cell:hover { background: var(--bg-secondary); }

/* Chips de evento en semana */
.cal-event-chip {
  font-size: 11px; font-weight: 500;
  padding: 3px 6px;
  margin-bottom: 2px;
  border-radius: 4px;
  border-left: 3px solid var(--primary);
  background: var(--primary-bg);
  color: var(--text-primary);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer;
  transition: opacity var(--t-fast);
}
.cal-event-chip:hover { opacity: 0.8; }

/* ════════════════════════════════════════════
   VISTA DÍA
   ════════════════════════════════════════════ */
.cal-day-wrapper {
  background: var(--bg-card);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.cal-day-scroll { overflow-y: auto; max-height: 600px; }
.cal-day-row {
  display: grid;
  grid-template-columns: 64px 1fr;
  border-bottom: 1px solid var(--separator);
  min-height: 52px;
  position: relative;
}
.cal-day-row.now-hour { background: color-mix(in srgb, var(--primary) 4%, transparent); }
.cal-day-time-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  padding: 6px 10px 0;
  text-align: right;
  align-self: start;
  border-right: 1.5px solid var(--separator);
}
.cal-day-slot {
  padding: 4px 10px;
  position: relative;
  min-height: 52px;
}
/* Línea de "ahora" */
.cal-now-line {
  position: absolute;
  left: 0; right: 0;
  height: 2px; background: var(--primary);
  z-index: 2;
}
.cal-now-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--primary);
  position: absolute;
  left: -6px; top: -5px;
}

/* Eventos en vista día */
.cal-day-event {
  margin-bottom: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  border-left: 4px solid var(--primary);
  background: var(--primary-bg);
  cursor: pointer;
  transition: all var(--t-fast);
}
.cal-day-event:hover { opacity: 0.85; transform: translateX(2px); }
.cal-day-event-time { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.cal-day-event-title { font-size: 13px; color: var(--text-primary); font-weight: 600; }
.cal-day-event-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
