/*************************************************************
 * LAYOUT PRINCIPAL
 *************************************************************/
.cal-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.calendar-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  height: 100%;
}

/* Calendario: 62% — Panel: 38% */
.calendar-section {
  flex: 0 0 62%;
  min-width: 0;
}

.order-details-panel {
  flex: 1 1 0;
  min-width: 280px;
  background: #ffffff;
  border-radius: 16px;
  padding: 22px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.10);
  border: 1px solid #e2e8f0;
  position: sticky;
  top: 72px;
  max-height: calc(100vh - 90px);
  overflow-y: auto;
}

@media (max-width: 1100px) {
  .calendar-layout {
    flex-direction: column;
  }
  .calendar-section,
  .order-details-panel {
    flex: unset;
    width: 100%;
  }
  .order-details-panel {
    position: relative;
    top: auto;
    max-height: none;
  }
}

/*************************************************************
 * CALENDARIO — CONTENEDOR
 *************************************************************/
.calendar-grid {
  background: #ffffff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08);
  border: 1px solid #e2e8f0;
}

/*************************************************************
 * HEADER DEL CALENDARIO (título + filtro)
 *************************************************************/
.calendar-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.calendar-month-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin: 0;
  letter-spacing: -0.02em;
}

.calendar-filter {
  height: 36px;
  min-width: 190px;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  padding: 0 10px;
  font-size: 0.85rem;
  color: #334155;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s;
  font-weight: 500;
}
.calendar-filter:focus {
  outline: none;
  border-color: #3b82f6;
  background: #fff;
}

/*************************************************************
 * GRILLA DE DÍAS
 *************************************************************/
.days-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

/* Encabezados Dom–Sáb */
.calendar-day-header {
  text-align: center;
  font-weight: 700;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #64748b;
  padding: 8px 0 10px;
  border-bottom: 2px solid #e2e8f0;
  margin-bottom: 2px;
}

/* Celda vacía (relleno antes del día 1) */
.calendar-day-empty {
  min-height: 88px;
  background: transparent;
}

/*************************************************************
 * CELDA DE DÍA
 *************************************************************/
.calendar-day {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: #f8fafc;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px 6px 6px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  cursor: default;
  position: relative;
  overflow: hidden;
}
.calendar-day:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  z-index: 1;
}

/* Número del día */
.day-number {
  font-size: 0.85rem;
  font-weight: 700;
  color: #475569;
  align-self: flex-start;
  line-height: 1;
  margin-bottom: 5px;
}

/*************************************************************
 * MODIFICADORES DE CELDA — colores con más carácter
 *************************************************************/

/* Hoy */
.calendar-day.today {
  background: #eff6ff;
  border: 2px solid #3b82f6;
}
.calendar-day.today .day-number {
  color: #1d4ed8;
  background: #dbeafe;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
}

/* Viernes bloqueados */
.calendar-day.viernes {
  background: #f1f5f9;
  opacity: 0.4;
  cursor: not-allowed;
}

/* Días con pedido completo — verde vibrante */
.calendar-day.completo {
  background: #f0fdf4;
  border: 1.5px solid #4ade80;
}
.calendar-day.completo .day-number {
  color: #15803d;
}

/* Días con pedido incompleto — rojo/coral vibrante */
.calendar-day.incompleto {
  background: #fff1f2;
  border: 1.5px solid #f87171;
}
.calendar-day.incompleto .day-number {
  color: #b91c1c;
}

/* Días pasados sin pedido — ámbar vibrante */
.calendar-day.sin-pedido {
  background: #fffbeb;
  border: 1.5px solid #fbbf24;
}
.calendar-day.sin-pedido .day-number {
  color: #92400e;
}

/*************************************************************
 * BORDES DE COLOR POR MÓDULO (complementan el estado)
 *************************************************************/
.event-pedidos     { border-left: 4px solid #3b82f6; }
.event-inventarios { border-left: 4px solid #22c55e; }
.event-mermas      { border-left: 4px solid #ef4444; }
.event-traslados   { border-left: 4px solid #f97316; }

/*************************************************************
 * BOTONES DE EVENTO — tamaño uniforme
 *************************************************************/
.day-status {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}

.btn-tipo {
  /* Tamaño fijo para que todos sean iguales */
  display: block;
  width: 100%;
  height: 22px;
  line-height: 22px;
  box-sizing: border-box;

  font-size: 0.68rem;
  font-weight: 700;
  border-radius: 5px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  padding: 0 6px;
  cursor: pointer;
  text-align: left;

  /* Truncar texto largo — TODOS iguales */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  transition: background 0.12s, color 0.12s, border-color 0.12s;
  letter-spacing: 0.01em;
}
.btn-tipo:hover {
  background: #3b82f6;
  color: #fff;
  border-color: #3b82f6;
}

/* Variante completo: verde */
.calendar-day.completo .btn-tipo {
  border-color: #86efac;
  background: #dcfce7;
  color: #166534;
}
.calendar-day.completo .btn-tipo:hover {
  background: #16a34a;
  color: #fff;
  border-color: #16a34a;
}

/* Variante incompleto: rojo */
.calendar-day.incompleto .btn-tipo {
  border-color: #fca5a5;
  background: #fee2e2;
  color: #991b1b;
}
.calendar-day.incompleto .btn-tipo:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* Botón "+N más" — dashed, neutro */
.btn-tipo.btn-mas {
  border-style: dashed;
  border-color: #94a3b8;
  color: #475569;
  background: #f1f5f9;
  font-weight: 600;
}
.btn-tipo.btn-mas:hover {
  background: #475569;
  color: #fff;
  border-color: #475569;
  border-style: solid;
}

/*************************************************************
 * PANEL LATERAL — DETALLE DEL EVENTO
 *************************************************************/
.cal-hint {
  font-size: 0.875rem;
  color: #94a3b8;
  text-align: center;
  padding: 32px 16px;
  margin: 0;
  line-height: 1.6;
}

/* Ícono decorativo en el hint */
.cal-hint::before {
  content: "📅";
  display: block;
  font-size: 2rem;
  margin-bottom: 10px;
}

.detalle-header {
  background: #f8fafc;
  border-left: 4px solid #3b82f6;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}
.detalle-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e2e8f0;
}
.detalle-header p {
  font-size: 0.825rem;
  color: #475569;
  margin: 5px 0;
  line-height: 1.4;
}
.detalle-header strong {
  color: #0f172a;
  font-weight: 600;
}

.detalle-scroll {
  max-height: 360px;
  overflow-y: auto;
  margin-top: 4px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}
.detalle-scroll .tabla {
  font-size: 0.8rem;
}

/*************************************************************
 * MODAL — LISTA DE EVENTOS DEL DÍA
 *************************************************************/
.cal-modal-contenido {
  width: min(540px, 95vw);
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.cal-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid #f1f5f9;
  position: sticky;
  top: 0;
  background: #fff;
  border-radius: 14px 14px 0 0;
  z-index: 1;
}
.cal-modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}

.cal-eventos-lista {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.cal-evento-item {
  padding: 14px 22px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s;
}
.cal-evento-item:last-child {
  border-bottom: none;
}
.cal-evento-item:hover {
  background: #f8fafc;
}

.cal-evento-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.cal-evento-titulo {
  font-size: 0.875rem;
  color: #0f172a;
  margin: 0 0 4px;
  line-height: 1.4;
}
.cal-evento-titulo strong {
  font-weight: 700;
  color: #1e40af;
}

.cal-evento-sub {
  font-size: 0.78rem;
  color: #64748b;
  margin: 0;
}

.cal-evento-comentario {
  font-size: 0.78rem;
  color: #94a3b8;
  font-style: italic;
  margin: 6px 0 0;
  padding: 6px 8px;
  background: #f8fafc;
  border-radius: 4px;
  border-left: 3px solid #e2e8f0;
}

/*************************************************************
 * BOTÓN CERRAR
 *************************************************************/
.btn-cerrar {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #64748b;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}
.btn-cerrar:hover {
  background: #f1f5f9;
  color: #0f172a;
}

/*************************************************************
 * OCULTO
 *************************************************************/
.oculto {
  display: none !important;
}
