/* ==========================================================================
   Gestion TP - Module Calendrier FullCalendar
   Styles personnalisés pour l'intégration avec le thème existant
   ========================================================================== */

/* Variables CSS pour la cohérence avec le thème */
:root {
    --calendar-primary: #0d6efd;
    --calendar-success: #198754;
    --calendar-danger: #dc3545;
    --calendar-warning: #fd7e14;
    --calendar-info: #0dcaf0;
    --calendar-purple: #6f42c1;
    --calendar-teal: #20c997;
    --calendar-border: #dee2e6;
    --calendar-hover: rgba(0, 0, 0, 0.05);
}

/* Conteneur principal du calendrier */
#calendar {
    max-width: 100%;
    margin: 0 auto;
    font-family: 'Nunito', sans-serif;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Styles pour la toolbar du calendrier */
.fc-toolbar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem;
    border-radius: 0.375rem 0.375rem 0 0;
    margin-bottom: 0 !important;
}

.fc-toolbar-title {
    color: white !important;
    font-weight: 600;
    font-size: 1.5rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.fc-button-group .fc-button {
    background: rgba(255, 255, 255, 0.2) !important;
    border: 1px solid rgba(255, 255, 255, 0.3) !important;
    color: white !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.fc-button-group .fc-button:hover {
    background: rgba(255, 255, 255, 0.3) !important;
    border-color: rgba(255, 255, 255, 0.5) !important;
    transform: translateY(-1px);
}

.fc-button-group .fc-button:focus {
    box-shadow: 0 0 0 0.2rem rgba(255, 255, 255, 0.25) !important;
}

.fc-button-primary:not(:disabled).fc-button-active {
    background: white !important;
    color: var(--calendar-primary) !important;
    border-color: white !important;
    font-weight: 600;
}

/* Styles pour les boutons de vue personnalisés */
.calendar-view-buttons .btn {
    transition: all 0.2s ease;
    border-radius: 0.375rem;
    margin: 0 0.125rem;
}

.calendar-view-buttons .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
}

.calendar-view-buttons .btn.active {
    background: var(--calendar-primary);
    border-color: var(--calendar-primary);
    color: white;
    box-shadow: 0 0.125rem 0.25rem rgba(13, 110, 253, 0.25);
}

/* Styles pour le corps du calendrier */
.fc-view-harness {
    background: white;
}

/* En-têtes des jours */
.fc-col-header {
    background: #f8f9fa;
    border-bottom: 2px solid var(--calendar-border);
}

.fc-col-header-cell {
    padding: 0.75rem 0.5rem;
    font-weight: 600;
    color: #495057;
    text-transform: uppercase;
    font-size: 0.875rem;
    letter-spacing: 0.5px;
}

/* Cellules des jours */
.fc-daygrid-day {
    min-height: 100px;
    transition: background-color 0.2s ease;
}

.fc-daygrid-day:hover {
    background-color: var(--calendar-hover);
}

.fc-daygrid-day-number {
    padding: 0.5rem;
    font-weight: 500;
    color: #495057;
    transition: color 0.2s ease;
}

.fc-day-today {
    background-color: rgba(13, 110, 253, 0.1) !important;
    border-color: var(--calendar-primary) !important;
}

.fc-day-today .fc-daygrid-day-number {
    background: var(--calendar-primary);
    color: white !important;
    border-radius: 50%;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0.25rem;
    font-weight: 600;
}

/* Styles pour les événements */
.fc-event {
    cursor: pointer;
    border: none !important;
    border-radius: 0.375rem !important;
    padding: 0.25rem 0.5rem !important;
    margin: 0.125rem !important;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.1);
}

.fc-event:hover {
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.15);
    opacity: 0.9;
}

.fc-event-title {
    font-size: 0.875rem;
    line-height: 1.2;
}

/* Styles spécifiques par catégorie */
.fc-event[data-category="meeting"] {
    background: linear-gradient(135deg, #0d6efd, #0b5ed7) !important;
}

.fc-event[data-category="task"] {
    background: linear-gradient(135deg, #198754, #157347) !important;
}

.fc-event[data-category="reminder"] {
    background: linear-gradient(135deg, #fd7e14, #e55a00) !important;
}

.fc-event[data-category="other"] {
    background: linear-gradient(135deg, #6f42c1, #5a32a3) !important;
}

/* Vue timeline et autres vues */
.fc-timegrid-slot {
    border-color: var(--calendar-border);
    height: 3rem;
}

.fc-timegrid-axis {
    background: #f8f9fa;
    font-size: 0.875rem;
    color: #6c757d;
}

.fc-timegrid-divider {
    background: var(--calendar-border);
}

/* Vue liste */
.fc-list-event {
    transition: background-color 0.2s ease;
}

.fc-list-event:hover {
    background-color: var(--calendar-hover);
}

.fc-list-event-title {
    font-weight: 500;
}

/* Modal personnalisé */
.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom: none;
    border-radius: 0.5rem 0.5rem 0 0;
}

.modal-title {
    font-weight: 600;
}

.btn-close {
    filter: invert(1);
}

/* Formulaire dans le modal */
.form-label {
    font-weight: 500;
    color: #495057;
}

.form-control:focus {
    border-color: var(--calendar-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-select:focus {
    border-color: var(--calendar-primary);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Sélecteur de couleur */
.form-control-color {
    width: 3rem;
    height: 2.5rem;
    border-radius: 0.375rem;
    border: 2px solid var(--calendar-border);
    cursor: pointer;
    transition: all 0.2s ease;
}

.form-control-color:hover {
    border-color: var(--calendar-primary);
    transform: scale(1.05);
}

/* Responsive Design */
@media (max-width: 768px) {
    .fc-toolbar {
        flex-direction: column;
        gap: 1rem;
    }
    
    .fc-toolbar-chunk {
        display: flex;
        justify-content: center;
    }
    
    .fc-button-group {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }
    
    .fc-button-group .fc-button {
        flex: 0 0 auto;
        padding: 0.375rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .calendar-view-buttons {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .calendar-view-buttons .btn {
        flex: 1;
        min-width: 80px;
        margin: 0;
    }
    
    /* Ajuster la hauteur des cellules sur mobile */
    .fc-daygrid-day {
        min-height: 80px;
    }
    
    .fc-event-title {
        font-size: 0.75rem;
    }
    
    /* Modal plus petit sur mobile */
    .modal-dialog {
        margin: 1rem 0.5rem;
    }
}

@media (max-width: 576px) {
    .fc-toolbar-title {
        font-size: 1.25rem;
    }
    
    .fc-daygrid-day {
        min-height: 60px;
    }
    
    .fc-daygrid-day-number {
        padding: 0.25rem;
    }
    
    .fc-event {
        padding: 0.125rem 0.25rem !important;
        margin: 0.0625rem !important;
    }
    
    .fc-event-title {
        font-size: 0.7rem;
    }
}

/* Animations et transitions */
@keyframes eventPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.fc-event.new-event {
    animation: eventPulse 0.6s ease-in-out;
}

/* Indicateurs de statut */
.event-indicator {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    z-index: 2;
}

.event-indicator.urgent {
    background: var(--calendar-danger);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Plus d'événements (more events) */
.fc-more-link {
    color: var(--calendar-primary) !important;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.2s ease;
}

.fc-more-link:hover {
    background-color: rgba(13, 110, 253, 0.1);
    text-decoration: none;
}

/* Amélioration de l'accessibilité */
.fc-event:focus {
    outline: 2px solid var(--calendar-primary);
    outline-offset: 2px;
}

.fc-button:focus {
    outline: 2px solid white;
    outline-offset: 2px;
}

/* Style pour l'impression */
@media print {
    .fc-toolbar,
    .calendar-view-buttons,
    .modal {
        display: none !important;
    }
    
    .fc-event {
        color: black !important;
        background: white !important;
        border: 1px solid black !important;
    }
    
    .fc-daygrid-day {
        min-height: 80px;
    }
}