/* FullCalendar Custom Styles */

#fullcalendar {
    background: white;
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    height: 660px;
    max-height: 660px;
    overflow: auto;
}

/* Forzar altura del calendario */
.fc {
    height: 650px !important;
    max-height: 650px !important;
}

/* Reducir altura de las celdas del mes */
.fc .fc-daygrid-day {
    height: auto !important;
    min-height: 120px !important;
    max-height: none !important;
}

.fc .fc-daygrid-day-frame {
    height: auto !important;
    min-height: 120px !important;
    max-height: none !important;
    overflow: visible !important;
}

.fc .fc-scrollgrid {
    border-width: 1px !important;
}

.fc-daygrid-body {
    height: auto !important;
}

.fc .fc-scrollgrid-section-body > td {
    border: 1px solid #ddd !important;
}

/* Reducir tamaño de los números de día */
.fc .fc-daygrid-day-number {
    font-size: 0.9rem;
    padding: 4px;
}

/* Reducir margen de los eventos */
.fc .fc-daygrid-event {
    margin: 2px 1px !important;
    padding: 3px 5px !important;
    font-size: 0.75rem !important;
    white-space: normal !important;
    line-height: 1.2 !important;
    overflow: visible !important;
    text-overflow: clip !important;
}

/* Mostrar tiempo en eventos de vista mensual */
.fc-daygrid-event .fc-event-time {
    font-weight: 600 !important;
    display: block !important;
}

/* Título del evento más visible */
.fc-daygrid-event .fc-event-title {
    font-weight: 400 !important;
    display: block !important;
}

/* Permitir que los eventos se expandan */
.fc-daygrid-day-frame {
    min-height: auto !important;
    height: auto !important;
}

.fc-daygrid-day-events {
    margin-bottom: 5px !important;
    overflow: visible !important;
}

/* Contenedor de eventos expandible */
.fc-daygrid-event-harness {
    margin-bottom: 2px !important;
}

/* Estilo para horario no laboral */
.fc .fc-non-business {
    background: #f8f8f8;
}

/* Ajustar altura de las vistas de semana y día */
.fc-timegrid-slot {
    height: 40px !important;
}

/* Reducir padding del header */
.fc .fc-col-header-cell {
    padding: 4px 2px !important;
}

/* Aumentar ancho de la columna de hora y semana */
.fc .fc-timegrid-axis,
.fc .fc-daygrid-axis {
    width: 80px !important;
    min-width: 80px !important;
}

.fc-direction-ltr .fc-timegrid-slot-label-frame {
    display: table-cell !important;
    width: 70px !important;
    min-width: 70px !important;
}

.fc .fc-timegrid-slot-label,
.fc .fc-timegrid-axis-cushion {
    width: 80px !important;
    min-width: 80px !important;
    padding: 0 8px !important;
    text-align: center !important;
    white-space: nowrap !important;
    display: block !important;
}

.fc .fc-timegrid-slot-label-cushion {
    padding: 0 8px !important;
    white-space: nowrap !important;
    display: block !important;
}

.fc-timegrid-axis-frame {
    display: table-cell !important;
    width: 70px !important;
}

/* Ancho de la columna de número de semana */
.fc .fc-daygrid-week-number {
    min-width: 70px !important;
    width: 70px !important;
    padding: 4px 8px !important;
    text-align: center !important;
    display: table-cell !important;
}

.fc-daygrid-week-number-frame {
    width: 70px !important;
    display: block !important;
}

/* Asegurar que la columna lateral se muestre */
.fc .fc-timegrid-axis-frame,
.fc .fc-daygrid-axis-frame {
    display: table-cell !important;
}

/* Toolbar compacto */
.fc .fc-toolbar {
    margin-bottom: 8px !important;
    padding: 0 !important;
}

.fc .fc-toolbar-title {
    font-size: 1.1rem !important;
    font-weight: 600;
    color: #2c3e50;
    margin: 0 !important;
    line-height: 1.2;
}

.fc .fc-button {
    padding: 4px 8px !important;
    font-size: 0.85rem !important;
}

.fc .fc-toolbar-chunk {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #fullcalendar {
        padding: 10px;
    }
    
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        gap: 5px;
    }
    
    .fc .fc-toolbar-title {
        font-size: 1.2rem;
        margin: 10px 0;
    }
    
    .fc .fc-button {
        font-size: 0.85rem;
        padding: 5px 10px;
    }
    
    .fc-header-toolbar {
        margin-bottom: 15px !important;
    }
}

/* Buttons */
.fc .fc-button-primary {
    background-color: #3498db;
    border-color: #3498db;
    transition: all 0.2s;
}

.fc .fc-button-primary:hover {
    background-color: #2980b9;
    border-color: #2980b9;
}

.fc .fc-button-primary:not(:disabled):active,
.fc .fc-button-primary:not(:disabled).fc-button-active {
    background-color: #2c3e50;
    border-color: #2c3e50;
}

.fc .fc-button-primary:disabled {
    background-color: #bdc3c7;
    border-color: #bdc3c7;
    opacity: 0.6;
}

/* Events */
.fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 0.85rem;
    transition: transform 0.2s;
}

.fc-event:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.fc-event-title {
    font-weight: 500;
}

/* Mobile event styles */
@media (max-width: 576px) {
    .fc-event {
        font-size: 0.75rem;
        padding: 1px 3px;
    }
    
    .fc-daygrid-event-harness {
        margin: 1px 0;
    }
}

/* Day grid */
.fc .fc-daygrid-day-number {
    color: #2c3e50;
    font-weight: 500;
    padding: 5px;
}

.fc .fc-day-today {
    background-color: rgba(52, 152, 219, 0.1) !important;
}

.fc .fc-day-today .fc-daygrid-day-number {
    background: #3498db;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Week numbers */
.fc .fc-daygrid-week-number {
    background-color: #ecf0f1;
    color: #7f8c8d;
    font-weight: 600;
}

/* Calendar legend */
.calendar-legend {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    margin-top: 15px;
}

@media (max-width: 576px) {
    .calendar-legend {
        gap: 10px;
    }
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.legend-color {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    display: inline-block;
}

/* Event details modal */
.event-details {
    text-align: left;
    padding: 10px;
}

.event-details h5 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.2rem;
}

.event-details p {
    margin-bottom: 10px;
    color: #7f8c8d;
}

.event-details strong {
    color: #2c3e50;
}

/* Responsive */
@media (max-width: 768px) {
    #fullcalendar {
        padding: 10px;
    }
    
    .fc .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .fc .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }
    
    .fc .fc-toolbar-title {
        font-size: 1.2rem;
    }
    
    .fc-event {
        font-size: 0.75rem;
    }
    
    .calendar-legend {
        justify-content: center;
    }
}

/* Loading state */
.fc-loading {
    opacity: 0.5;
    pointer-events: none;
}

/* Worker Calendar - Estilos específicos */
.calendar-container-full {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
}

#worker-fullcalendar {
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    width: 100%;
    min-height: 700px;
}

#worker-fullcalendar .fc {
    width: 100% !important;
    height: auto !important;
}

/* Expandir columnas en vista semana */
#worker-fullcalendar .fc-timegrid-col {
    min-width: 140px !important;
}

#worker-fullcalendar .fc-col-header-cell {
    font-size: 0.95rem !important;
    padding: 10px 5px !important;
    white-space: normal !important;
    line-height: 1.3;
}

#worker-fullcalendar .fc-col-header-cell-cushion {
    display: block;
    padding: 2px;
}

#worker-fullcalendar .fc-timegrid-axis {
    width: 80px !important;
}

#worker-fullcalendar .fc-timegrid-slot-label {
    font-size: 0.9rem !important;
    width: 80px !important;
}

/* Título de evento más visible */
#worker-fullcalendar .fc-event-title {
    font-size: 0.85rem !important;
    font-weight: 500;
}

/* Vista header más compacto */
#worker-fullcalendar .fc-toolbar {
    margin-bottom: 15px !important;
}

#worker-fullcalendar .fc-toolbar-title {
    font-size: 1.3rem !important;
}

/* Ajustar scrollgrid para usar todo el espacio */
#worker-fullcalendar .fc-scrollgrid {
    border-collapse: collapse;
    width: 100%;
}

/* Botón de reserva */
.reserve-button-container {
    text-align: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.reserve-button-container .btn {
    padding: 10px 20px;
    font-size: 1rem;
    font-weight: 500;
}

/* Selección temporal */
.fc-event.temp-selection {
    opacity: 0.6;
    border: 2px dashed #3498db !important;
}

.fc-event.temp-selection:hover {
    opacity: 0.8;
}

/* Highlight para slots seleccionables */
.fc-timegrid-slot:hover {
    background-color: rgba(52, 152, 219, 0.1) !important;
    cursor: pointer;
}

/* Mejorar visibilidad de la selección */
.fc-highlight {
    background-color: rgba(52, 152, 219, 0.2) !important;
    border: 2px dashed #3498db !important;
}

/* Estilos para disponibilidad del trabajador */
.fc-event.availability {
    border-left: 4px solid #27ae60 !important;
}

.fc-event.availability.completed {
    opacity: 0.6;
    text-decoration: line-through;
}

.fc-event.availability.cancelled {
    opacity: 0.4;
    background-color: #95a5a6 !important;
}
