/* --- CALENDARIO GRID SYSTEM --- */

.calendar-wrapper {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.month-block {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    overflow: hidden;
}

.month-header {
    padding: 1rem;
    background: #f8f9fa;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    border-bottom: 1px solid #eee;
}

.calendar-grid {
    display: grid;
    /* Cambiamos '1fr' por 'minmax(0, 1fr)' */
    /* Esto fuerza a la columna a tener ancho 0 como mínimo, evitando que el contenido la empuje */
    grid-template-columns: repeat(7, minmax(0, 1fr));
    /* <--- CAMBIO CRÍTICO */
    gap: 1px;
    background: #eee;
}


/* Cabecera de días (Lun, Mar...) */

.day-name {
    background: #fff;
    padding: 0.5rem;
    text-align: center;
    font-size: 0.75rem;
    font-weight: 700;
    color: #6c757d;
}


/* Celdas de días */

.calendar-day {
    background: #fff;
    min-height: 120px;
    /* Altura mínima para escritorio */
    padding: 4px;
    position: relative;
    transition: background 0.2s;
}

.calendar-day:hover {
    background: #fafafa;
}

.calendar-day.empty {
    background: #fcfcfc;
}

.day-number {
    font-size: 0.8rem;
    font-weight: bold;
    color: #adb5bd;
    margin-bottom: 4px;
    display: block;
    text-align: right;
    padding-right: 4px;
}

.calendar-day.today .day-number {
    color: #0d6efd;
    font-weight: 900;
}


/* Chips de Tareas */

.cal-task-chip {
    display: flex;
    align-items: flex-start;
    /* Alineamos arriba, por si el texto ocupa 2 líneas */
    font-size: 0.7rem;
    padding: 3px 4px;
    /* Un poco más de padding vertical para que respire */
    margin-bottom: 2px;
    border-radius: 3px;
    background: #e9ecef;
    color: #333;
    text-decoration: none;
    cursor: pointer;
    /* --- LÓGICA DE WRAP --- */
    white-space: normal;
    /* <--- CAMBIO: Permite salto de línea (antes nowrap) */
    word-wrap: break-word;
    /* <--- NUEVO: Rompe palabras largas si es necesario */
    overflow-wrap: break-word;
    /* <--- NUEVO: Estándar moderno */
    overflow: visible;
    /* <--- CAMBIO: Dejar ver el contenido (antes hidden) */
    height: auto;
    /* <--- NUEVO: Permitir que crezca en altura */
    line-height: 1.2;
    /* <--- NUEVO: Mejor lectura en multilínea */
    transition: transform 0.1s;
    border-left: 3px solid transparent;
}

.cal-task-chip:hover {
    transform: translateX(2px);
    background: #e2e6ea;
    color: #000;
}


/* Colores por prioridad (reutilizando tu lógica) */

.cal-prio-critical {
    border-left-color: #dc3545;
    background: #fff5f5;
}

.cal-prio-high {
    border-left-color: #ffc107;
    background: #fffbf0;
}

.cal-prio-medium {
    border-left-color: #0d6efd;
    background: #f0f7ff;
}

.cal-prio-normal {
    border-left-color: #6c757d;
}

.cal-completed {
    opacity: 0.6;
    text-decoration: line-through;
}


/* --- RESPONSIVE MOBILE --- */

@media (max-width: 768px) {
    .calendar-grid {
        display: flex;
        flex-direction: column;
        /* En móvil se convierte en lista vertical */
    }
    .day-name,
    .calendar-day.empty {
        display: none;
        /* Ocultar cabeceras y días vacíos en móvil */
    }
    .calendar-day {
        min-height: auto;
        border-bottom: 1px solid #eee;
        padding: 10px;
    }
    .day-number {
        text-align: left;
        font-size: 1rem;
        margin-bottom: 8px;
        color: #000;
    }
}


/* Opción 1: Recuadro Azul */

.calendar-day.today {
    background-color: #fff;
    /* Fondo blanco puro */
    box-shadow: inset 0 0 0 2px #0d6efd;
    /* Borde interior simulado para no afectar el tamaño */
    z-index: 1;
    /* Para que quede por encima de las líneas del grid */
}


/* Opcional: Resaltar también el número */

.calendar-day.today .day-number {
    background-color: #0d6efd;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    /* Alinear a la derecha */
}