/**
 * CSS Frontend - Calendrier
 *
 * @package DSI\Location
 * @since 2.0.0
 */

/* ==========================================================================
   Conteneur calendrier
   ========================================================================== */
.dsi-reservation-block {
    border: 1px solid gray;
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 2rem;
    box-shadow: 7px 7px 5px #ccc;
}

.calendar-head {
    display: flex;
    justify-content: space-between;
}

.calendar-head h4 {
    flex: 4;
}

.calendar-head button {
    flex: 1;
    margin-bottom: 10px;
}

.calendar-row {
    display: flex;
}

.calendar-col {
    width: 50%;
}

/* ==========================================================================
   Calendrier FullCalendar
   ========================================================================== */
#dsi-location-calendar,
#dsi-location-calendar-sc {
    background: white;
    padding: 20px;
    border-radius: 6px;
    margin: 20px 0;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

#dsi-location-calendar.loading {
    opacity: 0.6;
    pointer-events: none;
}

.dsi-calendar {
    width: 50%;
    margin-bottom: 10px;
    min-height: 400px;
}

/* Personnalisation FullCalendar */
.fc-daygrid-day-frame.fc-scrollgrid-sync-inner {
    height: 30px;
}

.fc-scroller.fc-scroller-liquid-absolute {
    overflow-y: hidden !important;
}

.fc-day-today {
    background-color: white !important;
    border: 2px solid #ccc !important;
}

.fc-day-past {
    background-color: whitesmoke;
}

/* En-têtes des jours - réduction du padding pour éviter le débordement */
.fc-col-header-cell {
    padding: 8px 0 !important;
}

.fc-col-header-cell-cushion {
    padding: 4px 0 !important;
}

/* Forcer le calendrier à s'adapter au conteneur sans scroll */
.dsi-calendar .fc {
    max-width: 100%;
}

.dsi-calendar .fc-view-harness {
    overflow-x: hidden !important;
}

.dsi-calendar table {
    width: 100% !important;
    table-layout: fixed !important;
}

.dsi-calendar .fc-scrollgrid {
    border-collapse: collapse !important;
    width: 100% !important;
}

/* Styles des événements */
.fc-event {
    cursor: pointer;
    border-radius: 4px;
    padding: 2px 4px;
}

.fc-event.reservation-event {
    background-color: var(--dsi-danger);
    border-color: var(--dsi-danger);
}

.fc-event.maintenance-event {
    background-color: var(--dsi-warning);
    border-color: var(--dsi-warning);
}

.fc-event.available-event {
    background-color: var(--dsi-success);
    border-color: var(--dsi-success);
}

/* Demi-journées */
.demi {
    position: relative;
    background-color: white;
}

.demi:after {
    content: "";
    position: absolute;
    width: 100%;
    height: 50%;
    background-color: white;
}

.matin:after {
    bottom: 0;
}

.aprem:after {
    top: 0;
}

/* ==========================================================================
   Modale réservations utilisateur
   ========================================================================== */
@keyframes dsi-reservation-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dsi-reservation-modal-slide-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.dsi-reservation-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.dsi-reservation-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: dsi-reservation-modal-fade-in 0.2s ease-out;
}

.dsi-reservation-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-radius: 16px;
    max-width: 1100px;
    width: calc(100% - 40px);
    max-height: calc(100vh - 80px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: dsi-reservation-modal-slide-in 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.dsi-reservation-modal-content h3 {
    margin: 0;
    padding: 24px 32px;
    font-size: 1.25rem;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.025em;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(180deg, #ffffff 0%, #f9fafb 100%);
    display: flex;
    align-items: center;
    gap: 12px;
}

.dsi-reservation-modal-content h3::before {
    content: '';
    display: inline-block;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #00857f 0%, #33c1ba 100%);
    border-radius: 8px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M19 3h-1V1h-2v2H8V1H6v2H5c-1.11 0-1.99.9-1.99 2L3 19c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zm0 16H5V8h14v11zM9 10H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm-8 4H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 20px;
    flex-shrink: 0;
}

.dsi-close-modal {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #9ca3af;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 1;
}

.dsi-close-modal:hover {
    background: #f3f4f6;
    color: #374151;
}

.dsi-reservation-table-wrapper {
    padding: 24px 32px 32px;
    overflow-y: auto;
    flex: 1;
}

.dsi-reservation-modal table.user-reservations-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.dsi-reservation-modal table.user-reservations-table thead {
    background: linear-gradient(180deg, #00857f 0%, #006961 100%);
}

.dsi-reservation-modal table.user-reservations-table th {
    padding: 14px 16px;
    font-size: 0.813rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #ffffff;
    border: none;
    text-align: left;
}

.dsi-reservation-modal table.user-reservations-table th:first-child {
    border-top-left-radius: 12px;
}

.dsi-reservation-modal table.user-reservations-table th:last-child {
    border-top-right-radius: 12px;
}

.dsi-reservation-modal table.user-reservations-table tbody tr {
    transition: background-color 0.15s ease;
}

.dsi-reservation-modal table.user-reservations-table tbody tr:nth-child(even) {
    background-color: #f9fafb;
}

.dsi-reservation-modal table.user-reservations-table tbody tr:hover {
    background-color: #f0fdfa;
}

.dsi-reservation-modal table.user-reservations-table td {
    padding: 14px 16px;
    font-size: 0.938rem;
    color: #374151;
    border: none;
    border-bottom: 1px solid #e5e7eb;
    vertical-align: middle;
}

.dsi-reservation-modal table.user-reservations-table tbody tr:last-child td {
    border-bottom: none;
}

.dsi-reservation-modal table.user-reservations-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.dsi-reservation-modal table.user-reservations-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

/* Message vide stylisé */
.dsi-reservation-modal table.user-reservations-table tbody td[colspan] {
    text-align: center;
    padding: 40px 16px;
    color: #6b7280;
    font-style: italic;
}

/* Boutons d'action dans la modale */
.dsi-reservation-modal .button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    margin-right: 8px;
}

/* Bouton Annuler - Style outlined gris */
.dsi-reservation-modal .button.cancel-reservation {
    background: #f0c807;
    color: #374151;
    border: 1px solid #d1d5db;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dsi-reservation-modal .button.btn-annuler.cancel-reservation:hover {
    background: #f9fafb !important;
    border-color: #9ca3af;
    color: #ef4444 !important;
}

/* Bouton Confirmer - Style rouge comme "Supprimer" */
.dsi-reservation-modal .button.validate-cancel-reservation {
    background: #ef4444;
    color: #ffffff;
    border: none;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.dsi-reservation-modal .button.validate-cancel-reservation:hover {
    background: #dc2626 !important;
}

.dsi-reservation-modal .button:active {
    transform: translateY(0);
}

/* Message d'avertissement délai annulation */
.dsi-reservation-modal table.user-reservations-table td:last-child {
    min-width: 200px;
}

.dsi-reservation-modal table.user-reservations-table td span[style*="color:red"],
.dsi-reservation-modal table.user-reservations-table td span[style*="color: red"] {
    display: block;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    color: #dc2626 !important;
    font-size: 0.813rem;
    line-height: 1.4;
}

/* Réservations passées/terminées */
.dsi-reservation-modal table.user-reservations-table tbody tr.past-reservation {
    opacity: 0.7;
    background-color: #f5f5f5;
}

.dsi-reservation-modal table.user-reservations-table tbody tr.past-reservation:hover {
    background-color: #ebebeb;
}

.dsi-reservation-modal table.user-reservations-table .status-past {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    color: #000;
    font-size: 1rem;
    font-weight: 500;

}

/* Réservations annulées */
.dsi-reservation-modal table.user-reservations-table tbody tr.cancelled-reservation {
    opacity: 0.6;
    background-color: #fef2f2;
}

.dsi-reservation-modal table.user-reservations-table tbody tr.cancelled-reservation:hover {
    background-color: #fee2e2;
}

.dsi-reservation-modal table.user-reservations-table .status-cancelled {
    display: inline-block;
    padding: 4px 10px;
    background: #fecaca;
    border-radius: 4px;
    color: #dc2626;
    font-size: 0.813rem;
    font-weight: 500;
}

/* Responsive */
@media (max-width: 768px) {
    .dsi-reservation-modal-content {
        width: calc(100% - 24px);
        max-height: calc(100vh - 48px);
        border-radius: 12px;
    }

    .dsi-reservation-modal-content h3 {
        padding: 20px 20px;
        font-size: 1.125rem;
    }

    .dsi-reservation-table-wrapper {
        padding: 16px 20px 24px;
    }

    .dsi-reservation-modal table.user-reservations-table {
        display: block;
        overflow-x: auto;
    }

    .dsi-reservation-modal table.user-reservations-table th,
    .dsi-reservation-modal table.user-reservations-table td {
        padding: 12px;
        font-size: 0.813rem;
        white-space: nowrap;
    }

    .dsi-close-modal {
        top: 12px;
        right: 12px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* ==========================================================================
   Modale click sur le calendrier (style SweetAlert)
   ========================================================================== */
@keyframes dsi-click-calendar-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes dsi-click-calendar-modal-slide-in {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.dsi-click-calendar-modal {
    display: none;
    position: fixed;
    z-index: 999999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.dsi-click-calendar-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    animation: dsi-click-calendar-modal-fade-in 0.2s ease-out;
    cursor: pointer;
}

.dsi-click-calendar-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(180deg, #ffffff 0%, #fafafa 100%);
    border-radius: 16px;
    max-width: 700px;
    width: calc(100% - 40px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    animation: dsi-click-calendar-modal-slide-in 0.3s ease-out;
    padding: 32px;
}

.dsi-click-calendar-modal-body {
    display: flex;
    align-items: center;
    gap: 32px;
}

/* Illustration du formulaire */
.dsi-click-calendar-modal-illustration {
    flex-shrink: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.dsi-form-preview {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 12px;
    width: 200px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.dsi-form-preview-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
}

.dsi-form-preview-col {
    flex: 1;
}

.dsi-form-preview-label {
    display: block;
    font-size: 0.65rem;
    color: #374151;
    margin-bottom: 3px;
    font-weight: 500;
}

.dsi-form-preview-input {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 6px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.6rem;
    color: #9ca3af;
    margin-bottom: 4px;
    background: #fff;
}

.dsi-form-preview-times {
    display: flex;
    gap: 3px;
}

.dsi-form-preview-time {
    flex: 1;
    padding: 3px 4px;
    font-size: 0.55rem;
    border: 1px solid #d1d5db;
    border-radius: 3px;
    text-align: center;
    color: #6b7280;
    background: #fff;
    white-space: nowrap;
}

.dsi-form-preview-time.active {
    background: #00857f;
    border-color: #00857f;
    color: #fff;
}

.dsi-form-preview-btn {
    background: #00857f;
    color: #fff;
    padding: 6px 10px;
    border-radius: 4px;
    font-size: 0.6rem;
    text-align: center;
    font-weight: 500;
}

.dsi-form-preview-arrow {
    margin-right: 12px;
    transform: rotate(180deg);
    animation: dsi-arrow-pulse 1.5s ease-in-out infinite;
}

@keyframes dsi-arrow-pulse {
    0%, 100% { transform: rotate(180deg) translateX(0); opacity: 1; }
    50% { transform: rotate(180deg) translateX(5px); opacity: 0.7; }
}

/* Texte de la modale */
.dsi-click-calendar-modal-text {
    flex: 1;
    text-align: center;
}

.dsi-click-calendar-modal-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    background: linear-gradient(135deg, #3b82f6 0%, #60a5fa 100%);
    border-radius: 50%;
}

.dsi-click-calendar-modal-icon svg {
    width: 32px;
    height: 32px;
    fill: white;
}

.dsi-click-calendar-modal-content h3 {
    margin: 0 0 16px 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: #111827;
    letter-spacing: -0.025em;
}

.dsi-click-calendar-table-wrapper {
    padding: 0;
}

.dsi-click-calendar-table-wrapper p {
    margin: 0;
    padding: 16px 20px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0369a1;
    font-size: 0.938rem;
    line-height: 1.5;
}

.dsi-close-calendar-modal {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    border: none;
    background: transparent;
    color: #9ca3af;
    border-radius: 8px;
    transition: all 0.2s ease;
    z-index: 1;
}

.dsi-close-calendar-modal:hover,
.dsi-close-calendar-modal:focus {
    background: #f3f4f6;
    color: #374151;
}

/* Responsive - Modale click calendrier */
@media (max-width: 768px) {
    .dsi-click-calendar-modal-content {
        width: calc(100% - 24px);
        padding: 24px;
        border-radius: 12px;
    }

    .dsi-click-calendar-modal-body {
        flex-direction: column;
        gap: 20px;
    }

    .dsi-click-calendar-modal-illustration {
        justify-content: center;
    }

    .dsi-form-preview {
        width: 100%;
        max-width: 220px;
    }

    .dsi-form-preview-arrow {
        display: none;
    }

    .dsi-click-calendar-modal-content h3 {
        font-size: 1.25rem;
    }

    .dsi-click-calendar-modal-icon {
        width: 56px;
        height: 56px;
    }

    .dsi-click-calendar-modal-icon svg {
        width: 28px;
        height: 28px;
    }

    .dsi-close-calendar-modal {
        top: 8px;
        right: 8px;
        width: 32px;
        height: 32px;
        font-size: 20px;
    }
}

/* ==========================================================================
   Conteneur calendrier de disponibilité (template)
   ========================================================================== */
.dsi-location-calendar-container {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 25px;
    margin: 30px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.dsi-calendar-header {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.dsi-calendar-title {
    margin: 0 0 10px 0;
    font-size: 1.4em;
    color: #333;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dsi-calendar-title .dashicons {
    font-size: 28px;
    width: 28px;
    height: 28px;
    color: #0073aa;
}

.dsi-calendar-description {
    margin: 0;
    color: #666;
    font-size: 0.95em;
}

/* Sélecteur d'unité */
.dsi-unit-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 6px;
}

.dsi-unit-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.dsi-unit-select {
    flex: 1;
    max-width: 300px;
    padding: 10px 15px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    background: white;
    transition: all 0.3s ease;
}

.dsi-unit-select:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

/* Bouton actualiser */
.dsi-refresh-calendar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.dsi-refresh-calendar:hover {
    background: #005a87;
    transform: translateY(-1px);
}

.dsi-refresh-calendar .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Zone calendrier */
.dsi-calendar-wrapper {
    position: relative;
    min-height: 500px;
    margin: 20px 0;
}

.dsi-location-calendar {
    background: white;
    border-radius: 6px;
    padding: 15px;
}

/* Indicateur de chargement */
.dsi-calendar-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 100;
}

.dsi-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #0073aa;
    border-radius: 50%;
    animation: dsi-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes dsi-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Légende */
.dsi-calendar-legend {
    margin-top: 25px;
    padding: 20px;
    background: #f9f9f9;
    border-radius: 6px;
}

.dsi-legend-title {
    margin: 0 0 15px 0;
    font-size: 1.1em;
    color: #333;
}

.dsi-legend-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

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

.dsi-legend-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    flex-shrink: 0;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.dsi-legend-color.own-reservation {
    background: #28a745;
}

.dsi-legend-color.other-reservation {
    background: #fdbaba;
}

.dsi-legend-color.maintenance {
    background: #17a2b8;
}

.dsi-legend-color.available {
    background: #f8f9fa;
    border: 2px solid #28a745;
}

.dsi-legend-text {
    font-size: 0.9em;
    color: #666;
}

/* Informations complémentaires */
.dsi-calendar-info {
    margin-top: 20px;
}

.dsi-info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 15px;
    background: #e7f3ff;
    border-left: 4px solid #0073aa;
    border-radius: 4px;
}

.dsi-info-box .dashicons {
    flex-shrink: 0;
    color: #0073aa;
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.dsi-info-content {
    flex: 1;
}

.dsi-info-content strong {
    display: block;
    margin-bottom: 5px;
    color: #0073aa;
}

.dsi-info-content p {
    margin: 0;
    color: #0c5460;
    font-size: 0.9em;
}

/* ==========================================================================
   Responsive - Calendrier conteneur
   ========================================================================== */
@media (max-width: 768px) {
    .dsi-location-calendar-container {
        padding: 15px;
    }

    .dsi-unit-selector-wrapper {
        flex-direction: column;
        align-items: stretch;
    }

    .dsi-unit-select {
        max-width: 100%;
    }

    .dsi-legend-items {
        grid-template-columns: 1fr;
    }
}



/*------- Mobile -------------*/
@media (max-width: 768px) {
  /* Empêcher le débordement horizontal sur toute la page */
  body {
    overflow-x: hidden !important;
  }

  /* Forcer le calendrier à prendre toute la largeur sur mobile */
  .dsi-calendar {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .dsi-reservation-block {
    padding: 0.5rem !important;
    margin-bottom: 1rem !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    box-sizing: border-box !important;
  }

  .calendar-row {
    flex-direction: column;
    width: 100% !important;
    max-width: 98% !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .calendar-col {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
  }

  /* Fix spécifique pour fc-scroller qui cause souvent les débordements */
  .dsi-calendar .fc-scroller,
  .dsi-calendar .fc-scroller-liquid-absolute {
    overflow: hidden !important;
    overflow-x: hidden !important;
  }

  /* S'assurer que le tableau du calendrier ne dépasse pas */
  .dsi-calendar .fc-scrollgrid-section,
  .dsi-calendar .fc-scrollgrid,
  .dsi-calendar table {
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  /* Forcer la largeur du conteneur FullCalendar */
  .dsi-calendar .fc,
  .dsi-calendar .fc-view-harness {
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden !important;
  }

  .dsi-calendar .fc-header-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: .4rem;
  }

  .dsi-calendar .fc-toolbar-chunk {
    display: flex;
    justify-content: center;
  }

  .dsi-calendar .fc-toolbar-title {
    text-align: center;
    margin: 0;
    line-height: 1.1;
    font-size: 20px;
  }

  .fc-toolbar-title {
    padding: 0 !important;
  }

  /* En-têtes des jours - encore plus compact sur mobile */
  .fc-col-header-cell {
    padding: 6px 0 !important;
    font-size: 0.75rem !important;
  }

  .fc-col-header-cell-cushion {
    padding: 2px 0 !important;
  }

  /* Réduire la taille de police des numéros de jours */
  .fc-daygrid-day-number {
    font-size: 0.85rem !important;
    padding: 2px !important;
  }

  /* Ajuster la hauteur des cellules */
  .fc-daygrid-day-frame {
    min-height: 35px !important;
  }
}
/*--------------- Modale ---------------*/
@media (max-width: 768px) {

  /* Table -> layout "cartes" */
  .dsi-reservation-modal-content .dsi-reservation-table-wrapper{
    overflow: visible; /* on évite le scroll */
  }

  .dsi-reservation-modal-content table.user-reservations-table,
  .dsi-reservation-modal-content table.user-reservations-table thead,
  .dsi-reservation-modal-content table.user-reservations-table tbody,
  .dsi-reservation-modal-content table.user-reservations-table tr,
  .dsi-reservation-modal-content table.user-reservations-table th,
  .dsi-reservation-modal-content table.user-reservations-table td{
    display: block;
    width: 100%;
    box-sizing: border-box;
  }

  /* Cache l'entête du tableau */
  .dsi-reservation-modal-content table.user-reservations-table thead{
    display: none;
  }

  /* Chaque ligne devient une "carte" */
  .dsi-reservation-modal-content table.user-reservations-table tbody tr{
    margin: 0 0 12px 0;
    padding: 10px;
    border: 1px solid rgba(0,0,0,.1);
    border-radius: 10px;
    background: #fff;
  }

  /* Chaque cellule devient une ligne "Label : Valeur" */
  .dsi-reservation-modal-content table.user-reservations-table tbody td{
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 6px 0;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .dsi-reservation-modal-content table.user-reservations-table tbody td::before{
    font-weight: 600;
    flex: 0 0 70px; /* largeur colonne label */
  }

  /* Labels (sans modifier le HTML) */
  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(1)::before{ content: "Du"; }
  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(2)::before{ content: "À"; }
  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(3)::before{ content: "Au"; }
  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(4)::before{ content: "À"; }
  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(5)::before{ content: "Action"; }

  /* Colonne Action : empiler contenu (boutons + texte) */
  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(5){
    flex-direction: column;
    align-items: stretch;
  }

  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(5)::before{
    flex: 0 0 auto;
    margin-bottom: 6px;
  }

  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(5) .button{
    width: 100%;
    max-width: 100%;
    white-space: normal; /* si libellé long */
  }

  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(5) br{
    display: none;
  }

  .dsi-reservation-modal-content table.user-reservations-table tbody td:nth-child(5) span{
    display: block;
    margin-top: 8px;
    font-size: 12px;
    line-height: 1.2;
  }
	
  /* La modale ne dépasse jamais l’écran */
  .dsi-reservation-modal-content{
    max-height: 85vh;              /* ajuste 80–90vh */
    overflow-y: auto;              /* scroll vertical interne */
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;  /* évite le “scroll chain” */
    padding-bottom: 14px;          /* un peu d’air en bas */
  }

  /* Optionnel : garder le titre visible pendant le scroll */
  .dsi-reservation-modal-content h3{
    position: sticky;
    top: 0;
    z-index: 2;
    background: #fff;
    margin: 0;
    padding: 12px 0;
  }

  /* Optionnel : garder le bouton fermer accessible */
  .dsi-reservation-modal-content .dsi-close-modal{
    position: sticky;  /* ou absolute si tu préfères */
    top: 10px;
    float: right;
    z-index: 3;
  }
	
}







@media (max-width: 768px){

  /* Empêche un micro overflow dû au 100vw */
  html, body {
    overflow-x: hidden;
} /* sinon hidden */

  /* Fait sortir le contenu du container du thème, pour prendre tout l'écran */
  #dsi-product-primary{
    float: none !important;

    width: 100vw !important;
    max-width: 100vw !important;

    /* breakout du container centré */
    margin-left: calc(50% - 50vw) !important;
    margin-right: calc(50% - 50vw) !important;

    /* ton “air” sur les côtés */
    padding: 0 1rem !important;
    box-sizing: border-box !important;
  }

  /* Sécurité : FullCalendar ne doit pas garder des widths en px */
  #dsi-product-primary .dsi-calendar,
  #dsi-product-primary .dsi-calendar .fc-daygrid-body,
  #dsi-product-primary .dsi-calendar .fc-col-header,
  #dsi-product-primary .dsi-calendar .fc-scrollgrid,
  #dsi-product-primary .dsi-calendar .fc-scrollgrid-sync-table,
  #dsi-product-primary .dsi-calendar table{
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box;
  }
}
