/* =============================================
   CALENDARIO DE DISPONIBILIDAD
   ============================================= */

:root {
  --cal-available: #5ec489;
  --cal-few: #d4a03a;
  --cal-full: #9ca3af;
  --cal-cancelled: #c0392b;
  --cal-today: #c97b3a;
}

.calendario {
  background: var(--crema, #f5f0e8);
}

.calendario .section-header {
  margin-bottom: 2rem;
}

/* Calendar container */
.cal-container {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(11, 29, 46, 0.08);
  overflow: hidden;
}

/* Month navigation */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: var(--azul-fondo, #0b1d2e);
  color: #fff;
}

.cal-nav h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.25rem;
  font-weight: 400;
  margin: 0;
  text-transform: capitalize;
}

.cal-nav button {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.cal-nav button:hover {
  background: rgba(255,255,255,0.2);
}

.cal-nav button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

/* Day headers */
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0.75rem 1rem 0.5rem;
  gap: 4px;
}

.cal-weekday {
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--azul-texto, #1a2d40);
  opacity: 0.5;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Day grid */
.cal-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 0.5rem 1rem 1rem;
  gap: 4px;
}

.cal-day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--azul-texto, #1a2d40);
  cursor: default;
  transition: all 0.2s;
  border: 2px solid transparent;
  gap: 2px;
}

.cal-day.empty {
  visibility: hidden;
}

.cal-day.past {
  opacity: 0.3;
}

.cal-day.today {
  border-color: var(--cal-today);
  font-weight: 700;
}

/* Availability dots */
.cal-day-dots {
  display: flex;
  justify-content: center;
  width: 100%;
}

.cal-dot {
  height: 5px;
  border-radius: 3px;
  flex-shrink: 0;
  transition: width 0.3s ease;
}

.cal-dot.morning {
  background: var(--cal-available);
}

.cal-dot.evening {
  background: var(--cal-today);
}

.cal-dot.few {
  background: var(--cal-few);
}

.cal-dot.full {
  background: var(--cal-full);
}

/* Disponible — small dot */
.cal-dot.available {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cal-available);
}

/* Algunas plazas — short bar */
.cal-dot.reservas-1 {
  width: 14px;
  background: #f0c929;
}

/* Pocas plazas — medium bar */
.cal-dot.reservas-2 {
  width: 24px;
  background: #e88b2e;
}

/* Completo — full width bar */
.cal-dot.reservas-3 {
  width: 85%;
  background: #dc3545;
}

/* Clickable days */
.cal-day.has-slots {
  cursor: pointer;
}

.cal-day.has-slots:hover {
  background: rgba(201, 123, 58, 0.08);
  border-color: var(--cal-today);
  transform: scale(1.05);
}

.cal-day.selected {
  background: var(--acento, #c97b3a);
  color: #fff;
  border-color: var(--acento, #c97b3a);
}

.cal-day.selected .cal-dot {
  background: rgba(255,255,255,0.7);
}

/* Legend */
.cal-legend {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  padding: 1rem 1rem 1.25rem;
  border-top: 1px solid rgba(0,0,0,0.06);
  flex-wrap: wrap;
}

.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--azul-texto, #1a2d40);
  opacity: 0.7;
}

.cal-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Day detail popup */
.cal-detail {
  display: none;
  margin-top: 1rem;
  padding: 1.25rem;
  background: var(--azul-fondo, #0b1d2e);
  color: #fff;
  border-radius: 12px;
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  animation: calSlideUp 0.3s ease;
}

.cal-detail.visible {
  display: block;
}

@keyframes calSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.cal-detail h4 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.1rem;
  margin: 0 0 0.75rem 0;
  font-weight: 400;
}

.cal-detail-slots {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.cal-slot {
  flex: 1;
  min-width: 200px;
  padding: 1rem;
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  cursor: pointer;
  transition: all 0.2s;
}

.cal-slot:hover {
  background: rgba(255,255,255,0.15);
  border-color: var(--acento, #c97b3a);
}

.cal-slot.selected-slot {
  background: rgba(255, 255, 255, 0.15) !important;
  border-color: var(--acento, #c97b3a) !important;
  box-shadow: 0 0 0 1px var(--acento, #c97b3a);
}

.cal-slot-label {
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-slot-label .cal-dot {
  width: 8px;
  height: 8px;
}

.cal-slot-info {
  font-size: 0.8rem;
  opacity: 0.7;
}

.cal-slot-price {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 0.5rem;
  color: var(--acento, #c97b3a);
}

.cal-slot.unavailable {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

/* Loading state */
.cal-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  color: var(--azul-texto, #1a2d40);
  opacity: 0.5;
}

.cal-loading::after {
  content: '';
  width: 24px;
  height: 24px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: calSpin 0.8s linear infinite;
  margin-left: 0.5rem;
}

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

/* Responsive */
@media (max-width: 600px) {
  .cal-container {
    border-radius: 12px;
  }
  
  .cal-nav {
    padding: 1rem;
  }
  
  .cal-nav h3 {
    font-size: 1.05rem;
  }
  
  .cal-days {
    padding: 0.5rem 0.5rem 0.75rem;
    gap: 2px;
  }
  
  .cal-day {
    font-size: 0.8rem;
    border-radius: 8px;
  }
  
  .cal-dot.available {
    width: 5px;
    height: 5px;
  }

  .cal-dot.reservas-1 {
    width: 12px;
  }

  .cal-dot.reservas-2 {
    width: 20px;
  }

  .cal-dot.reservas-3 {
    width: 80%;
  }
  
  .cal-legend {
    gap: 1rem;
    padding: 0.75rem;
  }
  
  .cal-detail-slots {
    flex-direction: column;
  }
}
