/* --- FACADE --- */
.datetime-trigger-wrapper {
    position: relative;
    cursor: pointer;
    display: block;
    /* Important pour le positionnement */
}

.datetime-trigger-input {
    background-color: #fff !important;
    /* Force fond blanc */
    cursor: pointer;
    caret-color: transparent;
    text-align: center;
    font-weight: bold;
}

/* --- POPOVER --- */
.datetime-picker-popover {
    position: absolute;
    /* top/left calculés en JS */
    z-index: 200000;
    /* Très haut pour passer au-dessus de tout (modal, header...) */
    background: #fff;
    border: 1px solid #ccc;
    border-radius: 8px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    padding: 10px;
    display: none;
    width: 340px;
    /* Assez large pour calendrier + heure */
    max-width: 95vw;
}

.datetime-picker-popover.show {
    display: block;
    animation: popIn 0.15s ease-out;
}

/* --- LAYOUT --- */
.datetime-picker-layout {
    display: flex;
    gap: 10px;
    height: 250px;
    /* Hauteur fixe */
}

/* --- CALENDRIER (Gauche) --- */
.datetime-calendar-section {
    flex: 3;
    display: flex;
    flex-direction: column;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.calendar-header button {
    background: none;
    border: none;
    font-weight: bold;
    cursor: pointer;
    padding: 5px 10px;
    font-size: 1.2rem;
}

.cal-month-label {
    font-weight: bold;
    font-size: 0.9rem;
}

.calendar-grid-header {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.75rem;
    color: #888;
    margin-bottom: 5px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    overflow-y: auto;
    /* Au cas où */
}

.cal-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    cursor: pointer;
    border-radius: 4px;
}

.cal-day:hover {
    background-color: #f0f0f0;
}

.cal-day.selected {
    background-color: #007bff;
    color: white;
    font-weight: bold;
}

/* --- HEURE (Droite) --- */
.datetime-time-section {
    flex: 2;
    display: flex;
    gap: 5px;
}

.datetime-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.column-label {
    text-align: center;
    font-size: 0.7rem;
    font-weight: bold;
    color: #666;
    margin-bottom: 2px;
}

.datetime-select {
    flex: 1;
    width: 100%;
    border: 1px solid #ddd;
    border-radius: 4px;
    overflow-y: auto;
    font-size: 1rem;
    padding: 0;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    scrollbar-width: thin;
    /* Firefox */
}

.datetime-select option {
    padding: 8px 5px;
    text-align: center;
    cursor: pointer;
    border-bottom: 1px solid #f9f9f9;
}

.datetime-select option:checked {
    background-color: #007bff;
    color: white;
}

/* --- ANIMATION --- */
@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- BACKDROP --- */
.datetime-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 199999;
    /* Juste sous le popover */
    background: transparent;
    /* Invisible mais bloque les clics */
    display: none;
}

.datetime-backdrop.show {
    display: block;
}

/* Mobile Optimizations */
@media (max-width: 500px) {
    .datetime-picker-popover {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        transform: translate(-50%, -50%) !important;
        width: 90vw;
        max-width: 350px;
    }

    .datetime-picker-popover.show {
        animation: popInCenter 0.2s ease-out;
    }

    @keyframes popInCenter {
        from {
            opacity: 0;
            transform: translate(-50%, -45%);
        }

        to {
            opacity: 1;
            transform: translate(-50%, -50%);
        }
    }

    .datetime-backdrop {
        background: rgba(0, 0, 0, 0.3);
        /* Griser le fond sur mobile pour focus */
    }
}