/**
 * ========================================
 * ESTILOS PARA CALENDARIO DE FECHAS MÚLTIPLES
 * Archivo: wwwroot/css/calendario-fechas-masivas.css
 * Para: Sistema de Asignación Masiva de Horas Extras
 * ========================================
 */

/* =======================================
   CONTENEDOR PRINCIPAL DEL CALENDARIO
   ======================================= */
.calendario-seleccion-multiple {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.calendario-component {
    background: white;
    border-radius: 6px;
    min-height: 280px;
    max-height: 320px;
    overflow: hidden;
}

/* =======================================
   HEADER DEL CALENDARIO
   ======================================= */
.calendario-header {
    padding: 0.5rem 0;
    border-bottom: 1px solid #dee2e6;
    margin-bottom: 1rem !important;
}

.calendario-header h5 {
    font-weight: 600;
    color: #495057;
}

.calendario-header .btn {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.calendario-header .btn:hover {
    background-color: #007bff;
    border-color: #007bff;
    color: white;
}

/* =======================================
   ESTRUCTURA REQUERIDA PARA EL CALENDARIO (CSS GRID)
   ======================================= */

/* Estructura requerida para el calendario */
.calendario-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    border: 1px solid #ddd;
    background-color: white;
}

.calendario-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background-color: #f8f9fa;
    font-weight: bold;
    border-bottom: 2px solid #dee2e6;
}

.calendario-header > div {
    padding: 0.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.8rem;
    background-color: #6c757d;
    color: white;
    border: 1px solid #5a6268;
}

/* OBLIGATORIO: Orden de días empezando en Lunes */
.dias-semana {
    content: "Lun Mar Mié Jue Vie Sáb Dom";
}

.dia-celda {
    width: 40px;
    height: 40px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    user-select: none;
}

.dia-seleccionado {
    background-color: #007bff;
    color: white;
}

/* =======================================
   CELDAS DEL CALENDARIO - SOBRESCRIBIR CON ESPECIFICACIONES EXACTAS
   ======================================= */

/* Estados de las fechas - usando las clases especificadas */
.dia-celda:hover {
    background-color: #e9ecef;
    transform: scale(1.05);
}

/* Estados de las fechas - ACTUALIZADOS SEGÚN ESPECIFICACIÓN */
.fecha-pasada {
    color: #6c757d;
    background-color: #f8f9fa;
    cursor: not-allowed;
    opacity: 0.5;
}

.fecha-pasada:hover {
    background-color: #f8f9fa !important;
    transform: none !important;
}

.fecha-hoy {
    background-color: #fff3cd;
    color: #856404;
    font-weight: bold;
    border: 2px solid #ffc107;
}

.fecha-hoy:hover {
    background-color: #ffc107;
    color: white;
}

/* CLASE ESPECIFICADA PARA FECHAS SELECCIONADAS */
.dia-seleccionado {
    background-color: #007bff;
    color: white;
    font-weight: bold;
    border: 2px solid #0056b3;
    position: relative;
}

.dia-seleccionado:hover {
    background-color: #0056b3 !important;
    transform: scale(1.05);
}

.dia-seleccionado::after {
    content: '✓';
    position: absolute;
    top: 1px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: bold;
}

/* Celdas vacías */
.calendario-celda-vacia {
    background-color: #f8f9fa;
    cursor: default;
}

/* =======================================
   PANEL DE FECHAS SELECCIONADAS
   ======================================= */
.fechas-seleccionadas-panel {
    background: white;
    border-radius: 6px;
    padding: 1rem;
    height: fit-content;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.fechas-seleccionadas-panel h6 {
    color: #495057;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.lista-fechas {
    max-height: 150px;
    overflow-y: auto;
    padding: 0.5rem 0;
}

.lista-fechas .badge {
    font-size: 0.75rem;
    padding: 0.4em 0.6em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.lista-fechas .btn-close {
    background-size: 0.6em;
}

/* =======================================
   VALIDACIONES Y ALERTAS
   ======================================= */
#validacion-fechas .alert {
    margin-bottom: 0;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
}

/* =======================================
   RESPONSIVE DESIGN
   ======================================= */
@media (max-width: 768px) {
    .calendario-seleccion-multiple {
        padding: 0.75rem;
    }
    
    .calendario-component {
        min-height: 260px;
        max-height: 300px;
    }
    
    .calendario-tabla {
        font-size: 0.8rem;
    }
    
    .calendario-tabla td {
        height: 30px;
    }
    
    .calendario-tabla th {
        font-size: 0.7rem;
        padding: 0.4rem 0.2rem;
    }
    
    .fechas-seleccionadas-panel {
        margin-top: 1rem;
        padding: 0.75rem;
    }
    
    .lista-fechas .badge {
        font-size: 0.7rem;
        padding: 0.3em 0.5em;
    }
}

@media (max-width: 576px) {
    .calendario-header .btn {
        width: 30px;
        height: 30px;
    }
    
    .calendario-header h5 {
        font-size: 1rem;
    }
    
    .calendario-tabla td {
        height: 28px;
    }
    
    .calendario-celda {
        font-size: 0.75rem;
    }
}

/* =======================================
   ANIMACIONES
   ======================================= */
@keyframes fadeInCalendar {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.calendario-component {
    animation: fadeInCalendar 0.3s ease-out;
}

@keyframes pulseSelection {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

.fecha-seleccionada {
    animation: pulseSelection 0.4s ease-in-out;
}

/* =======================================
   SCROLL PERSONALIZADO
   ======================================= */
.lista-fechas::-webkit-scrollbar {
    width: 4px;
}

.lista-fechas::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 2px;
}

.lista-fechas::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 2px;
}

.lista-fechas::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* =======================================
   ESTADOS DE CARGA
   ======================================= */
.calendario-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #6c757d;
}

.calendario-loading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* =======================================
   TOOLTIPS PERSONALIZADOS
   ======================================= */
.fecha-con-tooltip {
    position: relative;
}

.fecha-con-tooltip:hover::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 3px;
    font-size: 0.7rem;
    white-space: nowrap;
    z-index: 1000;
    margin-bottom: 5px;
}

.fecha-con-tooltip:hover::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-top-color: rgba(0,0,0,0.8);
    z-index: 1000;
}

/* =======================================
   ESTILOS PARA FECHAS DE SOLO LECTURA EN MODAL INDIVIDUAL
   ======================================= */
.fecha-asignada-cronologica {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    color: #495057;
    font-weight: 500;
    font-size: 0.875rem;
    cursor: default;
    user-select: none;
    min-width: 100px;
    text-align: center;
}

.fecha-asignada-cronologica:hover {
    background-color: #e9ecef;
}

/* Estado cuando el agente está aprobado */
tr.table-success .fecha-asignada-cronologica {
    background-color: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Estado cuando el agente está rechazado */
tr.table-danger .fecha-asignada-cronologica {
    background-color: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

/* Estado de fecha no asignada */
.fecha-asignada-cronologica:empty::before,
.fecha-asignada-cronologica[data-fecha=""]:not(:empty)::before {
    content: "No asignada";
    color: #6c757d;
    font-style: italic;
}

/* =======================================
   MEJORAS PARA ACCESIBILIDAD
   ======================================= */
.calendario-celda:focus {
    outline: 2px solid #007bff;
    outline-offset: -2px;
}

.fecha-seleccionada:focus {
    outline-color: #ffc107;
}

/* Soporte para modo de alto contraste */
@media (prefers-contrast: high) {
    .fecha-seleccionada {
        border: 3px solid #000;
    }
    
    .fecha-hoy {
        border: 3px solid #000;
    }
}

/* Soporte para reduced motion */
@media (prefers-reduced-motion: reduce) {
    .calendario-celda,
    .fecha-seleccionada,
    .calendario-component {
        transition: none;
        animation: none;
    }
}