/* --- Toolbar --- */
.calendar-toolbar {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    margin-bottom: 20px;
    gap: 15px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.week-label {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-dark);
    min-width: 200px;
    text-align: center;
}

.btn-icon {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    cursor: pointer;
    color: var(--text-color);
    transition: all 0.2s;
}

.btn-icon:hover {
    background-color: var(--bg-light);
    color: var(--primary);
    border-color: var(--primary);
}

.duration-control {
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
}

/* --- Grid --- */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 10px;
}

.day-column {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    min-width: 140px;
}

.day-header {
    background-color: var(--primary);
    color: white;
    padding: 10px;
    text-align: center;
}

.day-header.today {
    background-color: var(--accent);
}

.day-name {
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    opacity: 0.9;
}

.day-date {
    display: block;
    font-size: 1.2rem;
    font-weight: 700;
}

.day-slots {
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* --- Slots (Boutons) --- */
.slot-btn {
    width: 100%;
    padding: 8px;
    border: 1px solid #e0e0e0;
    background-color: white;
    border-radius: 6px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

/* Slot Disponible */
.slot-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Slot Occupé / Indisponible */
.slot-btn.busy {
    background-color: #f5f5f5;
    color: #ccc;
    border-color: #eee;
    cursor: not-allowed;
    text-decoration: line-through;
    opacity: 0.6;
}

/* Slot Réservé Récemment */
.slot-btn.just-booked {
    background-color: #e0f7fa;
    color: var(--accent);
    border-color: var(--accent);
    cursor: not-allowed;
    text-decoration: line-through;
    opacity: 0.8;
}

/* Slot Passé */
.slot-btn.past {
    display: none;
}

/* --- Modal --- */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    padding: 25px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.close-modal {
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-family: inherit;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

/* Mobile */
@media (max-width: 768px) {
    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .nav-controls {
        justify-content: space-between;
    }

    .week-label {
        min-width: auto;
    }
}

#booking-modal .modal-message {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 0.95rem;
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

#booking-modal .modal-message.success {
    background: #e6ffed;
    color: #08512b;
    border: 1px solid #99e6b9;
}

#booking-modal .modal-message.error {
    background: #fff1f0;
    color: #6f0f0f;
    border: 1px solid #f1b0b0;
}

#booking-modal .modal-message .icon {
    font-weight: 700;
    margin-right: 6px;
}

.summary-row {
    margin-bottom: 20px;
}

/* --- Styles de la Modale (Succès/Erreur) --- */

/* Zone d'erreur */
.alert-box {
    padding: 10px 15px;
    border-radius: 6px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-box.error {
    background-color: #fde8e8;
    color: #c53030;
    border: 1px solid #fbd5d5;
}

/* Vue Succès */
.success-body {
    text-align: center;
    padding: 30px 20px;
}

.success-icon-container {
    width: 60px;
    height: 60px;
    background-color: #def7ec;
    color: #03543f;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px auto;
    font-size: 1.8rem;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.success-body h4 {
    margin-bottom: 10px;
    color: var(--text-dark);
    font-size: 1.4rem;
}

.centered-footer {
    justify-content: center;
    border-top: none;
    padding-top: 0;
}

@keyframes popIn {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- Section Mes Rendez-vous (Historique & Futur) --- */
.appointments-wrapper {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.app-card {
    background: white;
    padding: 12px 15px;
    border-radius: 8px;
    border: 1px solid #eee;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
    flex: 1;
    min-width: 280px;
    transition: transform 0.2s;
}

.app-card.past {
    background-color: #f9f9f9;
    border-color: #eee;
    color: #888;
    font-style: italic;
    opacity: 0.8;
}

.app-card.future {
    border-left: 3px solid var(--primary);
}

.app-icon {
    width: 32px;
    height: 32px;
    background: #f0f4ff;
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.app-card.past .app-icon {
    background: #eee;
    color: #999;
}

.app-details {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.app-title {
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

.app-date {
    font-size: 0.85rem;
    opacity: 0.9;
}

.app-link {
    color: var(--primary);
    text-decoration: none;
    margin-left: auto;
    padding: 5px;
}

.app-link:hover {
    background-color: #f0f4ff;
    border-radius: 4px;
}

/* --- Responsive (Mobile) --- */
@media (max-width: 768px) {
    .calendar-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .nav-controls {
        justify-content: space-between;
        width: 100%;
    }

    .week-label {
        min-width: auto;
        font-size: 1rem;
    }

    .duration-control {
        width: 100%;
        justify-content: space-between;
    }

    .appointments-wrapper {
        flex-direction: column;
    }

    .app-card {
        min-width: 0;
        width: 100%;
        box-sizing: border-box;
    }

    .app-title {
        font-size: 0.95rem;
    }

    .modal-content {
        width: 95%;
        margin: 10px auto;
        padding: 15px;
        max-height: 95vh;
        overflow-y: auto;
    }

    .modal-header h3 {
        font-size: 1.2rem;
    }

    .modal-footer {
        flex-direction: column-reverse;
        gap: 10px;
    }

    .modal-footer .btn {
        width: 100%;
        padding: 12px;
    }

    label i {
        display: none !important;
    }

    .participants-container {
        flex-direction: column;
    }

    .user-select-list {
        max-height: 150px;
    }
}

/* --- Sélection des Participants (Modale) --- */
.participants-container {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.participant-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.participant-group label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.participant-group label i {
    color: var(--primary);
}

.user-select-list {
    border: 1px solid #eee;
    background: #fcfcfc;
    border-radius: 6px;
    max-height: 180px;
    overflow-y: auto;
    padding: 5px;
}

.user-select-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
}

.user-select-item:hover {
    background-color: #f0f4ff;
}

.user-select-item input[type="checkbox"] {
    margin-right: 10px;
    accent-color: var(--primary);
    cursor: pointer;
    width: 16px;
    height: 16px;
    margin-bottom: revert !important;
}

.user-info {
    display: flex;
    flex-direction: column;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-dark);
}

.user-role {
    font-size: 0.75rem;
    color: #888;
}

.loading-mini {
    padding: 10px;
    text-align: center;
    color: #999;
    font-size: 0.9rem;
}

/* Cas particulier : Utilisateur désactivé (Soi-même) */
.user-select-item.disabled {
    opacity: 0.7;
    background-color: #f9f9f9;
    cursor: default;
}