/**
 * SoPlanning - Half-Day Styles
 * Styles pour l'affichage des demi-journees (matin/apres-midi)
 *
 * @since 1.57.00
 */

/* ============================================
   CSS CONTAINMENT - OPTIMISATION RENDU
   @since 1.60.00

   IMPORTANT: Le badge commentaire doit pouvoir deborder des cellules.
   - content-visibility: auto SUPPRIME car cree un contexte de clipping
   - contain: paint SUPPRIME des elements proches du badge car clippe aussi
   - contain: style seul est OK (n'affecte pas le positionnement)
   ============================================ */

/* Lignes du planning : style containment seulement */
/* NOTE: content-visibility: auto SUPPRIME car clippe les badges absolus */
.planningContent > tbody > tr,
.planningContent tr[id^="ligne_"],
table.planningContent > tbody > tr {
    contain: style; /* Seulement style, pas paint qui clippe */
}

/* Cellules du planning : pas de paint containment pour permettre debordement */
.planningContent td.week,
.planningContent td.weekend,
td.planning-cell-split {
    contain: style; /* Seulement style, pas paint qui clippe */
    overflow: visible !important;
}

/* Zones demi-journees : pas de containment pour permettre aux badges de deborder */
.half-day-am,
.half-day-pm,
.half-day {
    /* contain: supprime pour permettre au badge de deborder vers cellules adjacentes */
    overflow: visible !important;
}

/* Taches/Projets : pas de contain, z-index pour passer au-dessus des cellules adjacentes */
.cellProject,
.cellProjectBiseau1,
.cellProjectBiseau2 {
    /* contain: desactive pour permettre au badge commentaire de deborder */
    z-index: 1;
    overflow: visible !important;
}

/* IMPORTANT: Elever le z-index des cellules contenant un badge commentaire
   pour qu'elles passent AU-DESSUS des cellules adjacentes */
td:has(.comment-badge),
td.planning-cell-split:has(.comment-badge) {
    z-index: 100 !important;
    position: relative;
}

.half-day:has(.comment-badge) {
    z-index: 100 !important;
}

.cellProject:has(.comment-badge),
.cellProjectBiseau1:has(.comment-badge),
.cellProjectBiseau2:has(.comment-badge) {
    z-index: 101 !important;
}

/* GPU acceleration pour les taches draggables pendant le drag */
html.dragging .cellProject[draggable="true"],
html.dragging .cellProjectBiseau1[draggable="true"],
html.dragging .cellProjectBiseau2[draggable="true"] {
    will-change: transform;
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* Grille du planning : isolation du style */
/* NOTE: contain: layout desactive pour permettre au badge commentaire de deborder */
.planningContent,
#divPlanning {
    contain: style;
}

/* Structure grid des cellules split */
.split-cell-grid {
    /* contain: layout; - Desactive pour permettre au badge commentaire de deborder */
}

/* ============================================
   CELLULES DIVISEES (MATIN/APRES-MIDI)
   ============================================ */

/* Cellule de planning divisee */
td.planning-cell-split {
    padding: 0 !important;
    position: relative;
    vertical-align: top;
    height: 1px; /* Force la cellule a prendre la hauteur du contenu minimum, puis s'etendre */
}

/* Structure CSS Grid principale */
.split-cell-grid {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: minmax(20px, 1fr) 2px minmax(20px, 1fr);
    min-height: 44px;
    height: 100%;
    position: relative; /* Pour le positionnement absolu des taches full-day */
    box-sizing: border-box;
    pointer-events: none; /* Les clics passent aux enfants */
}

.split-cell-grid > * {
    pointer-events: auto; /* Les enfants recoivent les clics */
}

/* Taches journee complete affichees dans AM et PM - pas d'indicateur visuel supplementaire */

/* Zone de demi-journee (matin ou apres-midi) */
.half-day {
    min-height: 20px;
    padding: 1px 2px;
    padding-left: 2px;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    z-index: 10; /* Au-dessus des taches full-day pour interactions */
}

/* Note: Les taches full-day se superposent aux zones AM/PM, pas besoin de decalage */

/* Zone matin - positionnement grid */
.half-day-am {
    grid-column: 1;
    grid-row: 1;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-left: 3px solid #ffc107;
}

/* Label AM discret */
.half-day-am::before {
    content: "AM";
    position: absolute;
    top: 1px;
    left: 4px;
    font-size: 8px;
    font-weight: 600;
    color: #b8860b;
    opacity: 0.6;
    letter-spacing: 0.5px;
    z-index: 1;
}

/* Zone apres-midi - positionnement grid */
.half-day-pm {
    grid-column: 1;
    grid-row: 3;
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%);
    border-left: 3px solid #2196f3;
}

/* Label PM discret */
.half-day-pm::before {
    content: "PM";
    position: absolute;
    top: 1px;
    left: 4px;
    font-size: 8px;
    font-weight: 600;
    color: #1565c0;
    opacity: 0.6;
    letter-spacing: 0.5px;
    z-index: 1;
}

/* Separateur entre matin et apres-midi - positionnement grid */
.half-day-separator {
    grid-column: 1;
    grid-row: 2;
    height: 2px;
    background: linear-gradient(to right,
        transparent 0%,
        rgba(255, 193, 7, 0.4) 10%,
        #e0e0e0 30%,
        #e0e0e0 70%,
        rgba(33, 150, 243, 0.4) 90%,
        transparent 100%);
    margin: 0;
    z-index: 150; /* Au-dessus des cellules avec badge (z-index: 100) */
    position: relative; /* Pour positionner le ::after correctement */
    overflow: visible;
}

/* Icone centrale sur le separateur - affiche l'heure de coupure personnalisee */
.half-day-separator::after {
    content: attr(data-break-time);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background: #fff;
    padding: 0 4px;
    font-size: 7px;
    font-weight: 500;
    color: #888;
    border-radius: 2px;
    line-height: 1.2;
    box-shadow: 0 0 2px rgba(0,0,0,0.1);
    z-index: 151; /* Au-dessus du separateur */
}

/* Fallback si pas de data-break-time (affiche 12h par defaut) */
.half-day-separator:not([data-break-time])::after {
    content: "12h";
}

/* Label d'heure de coupure (optionnel) */
.half-day-separator-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    padding: 0 3px;
    font-size: 8px;
    color: #999;
    line-height: 1;
    top: -4px;
}

/* Zone vide cliquable */
.half-day-empty {
    min-height: 14px;
    width: 100%;
}

/* ============================================
   FEEDBACK VISUEL DRAG AND DROP
   ============================================ */

/* Zone de drop active */
.half-day[drop-active="true"],
.half-day.halfday-drop-highlight {
    background-color: rgba(76, 175, 80, 0.15) !important;
    outline: 2px dashed #4CAF50;
    outline-offset: -2px;
}

/* Zone de drop invalide */
.half-day.halfday-drop-invalid {
    background-color: rgba(244, 67, 54, 0.15) !important;
    outline: 2px dashed #F44336;
    outline-offset: -2px;
}

/* Animation de survol */
.half-day {
    transition: background-color 0.15s ease, outline 0.15s ease, transform 0.1s ease;
    cursor: pointer;
}

/* ============================================
   OPTIMISATION: Desactiver transitions pendant le drag
   pour un feedback visuel instantane
   ============================================ */

/* Disable ALL transitions during drag for remote connection performance */
html.dragging .half-day,
html.dragging .half-day *,
html.dragging .cellProject,
html.dragging .cellProjectBiseau1,
html.dragging .cellProjectBiseau2,
html.dragging .basket-card,
html.dragging .planningContent td,
body.drag-active .half-day,
body.drag-active .half-day *,
body.drag-active .cellProject,
body.drag-select-active .half-day,
body.drag-select-active .half-day * {
    transition: none !important;
}

/* ============================================
   FEEDBACK VISUEL INSTANTANE PENDANT DRAG
   Desactive les transitions pour highlight immediat
   ============================================ */
html.dragging .half-day,
html.dragging .half-day-am,
html.dragging .half-day-pm,
html.dragging .half-day.sortable-drag-over,
html.dragging .half-day-am.sortable-drag-over,
html.dragging .half-day-pm.sortable-drag-over,
html.dragging .half-day.instant-highlight,
html.dragging .half-day-am.instant-highlight,
html.dragging .half-day-pm.instant-highlight {
    transition: none !important;
    transition-property: none !important;  /* Force disable all transition properties */
    transition-duration: 0s !important;    /* Ensure zero duration */
}

/* Reset GPU layer when not dragging */
html:not(.dragging) .cellProject,
html:not(.dragging) .cellProjectBiseau1,
html:not(.dragging) .cellProjectBiseau2 {
    will-change: auto;
}

/* Preparer le GPU pour les zones de drop actives */
.half-day[drop-active="true"],
.half-day.halfday-drop-highlight {
    will-change: background-color, outline;
}

/* GPU Layer pour les elements interactifs pendant le drag */
html.dragging .half-day,
body.drag-select-active .half-day {
    transform: translateZ(0); /* Force GPU layer */
    backface-visibility: hidden;
}

/* GPU acceleration pour la selection drag-select */
.half-day.drag-select-highlight {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* Respecter les preferences utilisateur pour les animations reduites */
@media (prefers-reduced-motion: reduce) {
    .half-day {
        transition: none;
    }
}

/* Effet de survol sur zone matin */
.half-day-am:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.25) 0%, rgba(255, 193, 7, 0.1) 100%) !important;
    box-shadow: inset 0 0 0 2px rgba(255, 193, 7, 0.5);
}

.half-day-am:hover::before {
    opacity: 1;
    font-size: 9px;
    color: #e6a100;
}

/* Effet de survol sur zone apres-midi */
.half-day-pm:hover {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.25) 0%, rgba(33, 150, 243, 0.1) 100%) !important;
    box-shadow: inset 0 0 0 2px rgba(33, 150, 243, 0.5);
}

.half-day-pm:hover::before {
    opacity: 1;
    font-size: 9px;
    color: #1976d2;
}

/* Effet de clic (active) sur zone matin */
.half-day-am:active {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.4) 0%, rgba(255, 193, 7, 0.2) 100%) !important;
    box-shadow: inset 0 0 0 2px rgba(255, 193, 7, 0.8);
    transform: scale(0.98);
}

/* Effet de clic (active) sur zone apres-midi */
.half-day-pm:active {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.4) 0%, rgba(33, 150, 243, 0.2) 100%) !important;
    box-shadow: inset 0 0 0 2px rgba(33, 150, 243, 0.8);
    transform: scale(0.98);
}

/* Empecher l'effet de focus/active sur la cellule parente TD quand elle contient des half-day */
td.planning-cell-split:focus,
td.planning-cell-split:active,
td.planning-cell-split:active:not(.read-only),
.planningContent td.week.planning-cell-split:active:not(.read-only),
.planningContent td.weekend.planning-cell-split:active:not(.read-only) {
    outline: none !important;
    background-color: transparent !important;
    background: transparent !important;
}

/* ============================================
   TACHES DANS LES DEMI-JOURNEES
   ============================================ */

/* Tache dans une demi-journee - empilees verticalement */
.half-day .cellProject,
.half-day .cellProjectBiseau1,
.half-day .cellProjectBiseau2 {
    width: calc(100% - 20px);
    max-width: calc(100% - 20px);
    margin: 1px 2px 1px 18px;
    min-height: 14px;
    flex: 0 0 auto;
}

/* Supprimer l'effet biseau texte (clip-path) dans les zones half-day
   car la position AM/PM indique deja la demi-journee */
.half-day .cellProjectBiseau1::before,
.half-day .cellProjectBiseau2::before {
    display: none !important;
}

/* Tache couvrant la journee complete (affichee dans les deux zones) */
.task-full-day {
    opacity: 0.7;
    border-style: dashed !important;
}

/* Ajustement pour tache complete sur cellule divisee */
.planning-cell-split .task-full-day {
    display: flex;
    flex-direction: column;
}

/* ============================================
   INDICATEURS DE DEMI-JOURNEE (sur les taches)
   ============================================ */

/* Les indicateurs sur taches ne sont plus necessaires car
   la position dans la zone AM/PM suffit */
.task-indicator-am,
.task-indicator-pm {
    /* Plus besoin d'indicateur visuel supplementaire */
}

/* Ancien style - garde pour retrocompatibilite */
.task-indicator-am-badge::before {
    content: "AM";
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 7px;
    background: rgba(255, 193, 7, 0.8);
    color: #333;
    padding: 0 2px;
    border-radius: 2px;
    line-height: 1.2;
}

.task-indicator-pm-badge::before {
    content: "PM";
    position: absolute;
    top: 1px;
    right: 1px;
    font-size: 7px;
    background: rgba(33, 150, 243, 0.8);
    color: #fff;
    padding: 0 2px;
    border-radius: 2px;
    line-height: 1.2;
}

/* ============================================
   TACHES HORS CALENDRIER
   ============================================ */

/* Indicateur visuel pour tache hors calendrier */
.task-hors-calendrier {
    border: 2px dashed #ff9800 !important;
    position: relative;
}

.task-hors-calendrier::after {
    content: "\f017"; /* Icone horloge Font Awesome */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    position: absolute;
    bottom: 1px;
    right: 1px;
    font-size: 8px;
    color: #ff9800;
    background: #fff;
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   MENU DE CHOIX DEMI-JOURNEE
   ============================================ */

/* Section choix demi-journee dans le menu */
#halfday_choice_section {
    border-top: 1px solid #eee;
    padding-top: 10px;
    margin-top: 10px;
}

#halfday_choice_section .form-check {
    margin-bottom: 5px;
}

#halfday_choice_section .form-check-label {
    font-size: 13px;
}

/* Icones pour les options */
#halfday_choice_section .halfday-icon-am {
    color: #ffc107;
    margin-right: 5px;
}

#halfday_choice_section .halfday-icon-pm {
    color: #2196f3;
    margin-right: 5px;
}

#halfday_choice_section .halfday-icon-full {
    color: #4caf50;
    margin-right: 5px;
}

/* ============================================
   FORMULAIRE DE TACHE - SECTION HORAIRES
   ============================================ */

/* Container d'info horaires */
#working_hours_info {
    padding: 5px 10px;
    background: #f8f9fa;
    border-radius: 4px;
    margin-top: 5px;
}

#working_hours_info .fa-clock {
    margin-right: 5px;
}

/* Section hors calendrier */
#hors_calendrier_section {
    margin-top: 10px;
}

#hors_calendrier_section .alert {
    padding: 10px 15px;
    margin-bottom: 0;
}

#hors_calendrier_raison_div {
    margin-top: 10px;
}

/* ============================================
   SELECTION DE PERIODE DANS LE FORMULAIRE
   ============================================ */

/* Groupe de choix de periode */
#halfday_selection .form-check-inline {
    margin-right: 15px;
}

#halfday_selection .form-check-label {
    padding-left: 5px;
}

/* Indicateurs visuels pour les options */
#periode_am + label::before {
    content: "\f185"; /* Icone soleil */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #ffc107;
    margin-right: 5px;
}

#periode_pm + label::before {
    content: "\f186"; /* Icone lune */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #2196f3;
    margin-right: 5px;
}

#periode_full + label::before {
    content: "\f073"; /* Icone calendrier */
    font-family: "Font Awesome 5 Free";
    font-weight: 900;
    color: #4caf50;
    margin-right: 5px;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 768px) {
    .half-day {
        min-height: 15px;
    }

    .half-day-separator {
        margin: 0 1px;
    }

    .task-indicator-am::before,
    .task-indicator-pm::before {
        font-size: 6px;
        padding: 0 1px;
    }

    #halfday_selection .form-check-inline {
        display: block;
        margin-bottom: 5px;
    }
}

/* ============================================
   MODE COMPACT (beaucoup de jours affiches)
   ============================================ */

.planning-compact .half-day-separator {
    display: none;
}

.planning-compact .half-day {
    min-height: 12px;
}

.planning-compact .task-indicator-am::before,
.planning-compact .task-indicator-pm::before {
    display: none;
}

/* ============================================
   IMPRESSION
   ============================================ */

/* ============================================
   PERIODES NON TRAVAILLEES
   ============================================ */

/* Zone AM ou PM non travaillee (grisee comme les week-ends) */
.half-day.half-day-not-worked {
    background: repeating-linear-gradient(
        -45deg,
        rgba(200, 200, 200, 0.15),
        rgba(200, 200, 200, 0.15) 2px,
        rgba(180, 180, 180, 0.1) 2px,
        rgba(180, 180, 180, 0.1) 4px
    ) !important;
    border-left-color: #bbb !important;
    opacity: 0.7;
}

/* Label de la zone non travaillee */
.half-day.half-day-not-worked::before {
    opacity: 0.4;
}

/* Desactiver le drop sur les zones non travaillees */
.half-day.half-day-not-worked[ondrop] {
    pointer-events: none;
}

/* Permettre quand meme les taches existantes d'etre visibles */
.half-day.half-day-not-worked .cellProject,
.half-day.half-day-not-worked .cellProjectBiseau1,
.half-day.half-day-not-worked .cellProjectBiseau2 {
    pointer-events: auto;
    opacity: 0.8;
}

@media print {
    .half-day-separator {
        background: #999;
    }

    .task-hors-calendrier {
        border-style: dashed !important;
    }

    .halfday-drop-highlight {
        background: none !important;
        outline: none !important;
    }

    .half-day.half-day-not-worked {
        background: #f0f0f0 !important;
    }
}

/* ============================================
   DRAG-SELECT (SELECTION PAR GLISSER)
   ============================================ */

/* Zone selectionnee pendant le glisser */
.half-day.drag-select-highlight {
    background: rgba(76, 175, 80, 0.25) !important;
    box-shadow: inset 0 0 0 2px rgba(76, 175, 80, 0.7);
    z-index: 25;
}

/* Zone de depart */
.half-day.drag-select-start {
    box-shadow: inset 0 0 0 3px #4CAF50 !important;
}

/* Zone de fin */
.half-day.drag-select-end {
    box-shadow: inset 0 0 0 3px #2196F3 !important;
}

/* Si start et end sont la meme cellule */
.half-day.drag-select-start.drag-select-end {
    box-shadow: inset 0 0 0 3px #9C27B0 !important;
}

/* Animation de selection - GPU acceleree */
.half-day.drag-select-highlight::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg,
        rgba(76, 175, 80, 0.1) 0%,
        rgba(76, 175, 80, 0.2) 50%,
        rgba(76, 175, 80, 0.1) 100%);
    pointer-events: none;
    animation: drag-select-pulse 0.8s ease-in-out infinite;
    /* GPU optimization */
    will-change: opacity;
    transform: translateZ(0);
}

@keyframes drag-select-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Desactiver l'animation sur les zones deja selectionnees hors focus */
.half-day.drag-select-highlight:not(.drag-select-start):not(.drag-select-end)::after {
    animation: none;
    opacity: 0.7;
}

/* Curseur pendant la selection */
.half-day {
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Style pour indiquer le mode selection active */
body.drag-select-active {
    cursor: crosshair !important;
}

body.drag-select-active .half-day {
    cursor: crosshair !important;
}

/* Style pour indiquer que le mode drag-select est disponible (Alt presse) */
body.drag-select-mode {
    cursor: crosshair !important;
}

body.drag-select-mode .half-day {
    cursor: crosshair !important;
}

/* Curseur bloque quand on glisse sur un autre user */
body.drag-select-blocked {
    cursor: not-allowed !important;
}

body.drag-select-blocked .half-day {
    cursor: not-allowed !important;
}

/* Indication visuelle subtile que Alt est presse */
body.drag-select-mode .half-day::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(76, 175, 80, 0.05);
    border: 1px dashed rgba(76, 175, 80, 0.3);
    pointer-events: none;
    z-index: 5;
}

/* ============================================
   DRAG & DROP MULTI-JOURS - LAYOUT COMPACT
   ============================================ */

/* Section multi-jours dans la popup - COMPACT */
#multiday_choice_section {
    border-top: 1px solid #eee;
    padding: 6px 0;
    margin-top: 4px;
}

/* Info de la tache multi-jours - COMPACT */
.multiday-task-info {
    background: #f8f9fa;
    padding: 5px 8px;
    border-radius: 4px;
    margin-bottom: 6px;
    border-left: 3px solid #6c757d;
}

.multiday-task-info .task-title {
    font-weight: 600;
    color: #333;
    font-size: 11px;
    display: block;
}

.multiday-task-info .task-dates {
    font-size: 10px;
    color: #666;
    display: block;
    margin-top: 1px;
}

/* Selecteur de mode horizontal - COMPACT */
.multiday-mode-selector {
    display: flex;
    flex-direction: row;
    gap: 4px;
    width: 100%;
}

/* Toggle de mode individuel - COMPACT */
.multiday-mode-selector .mode-toggle {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 5px 3px;
    border: 2px solid #e9ecef;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s ease;
    background: #fff;
    text-align: center;
}

.multiday-mode-selector .mode-toggle:hover:not(.disabled) {
    border-color: #80bdff;
    background: #f0f7ff;
}

.multiday-mode-selector .mode-toggle.active {
    border-color: #007bff;
    background: #e7f1ff;
}

.multiday-mode-selector .mode-toggle.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: #f5f5f5;
}

.multiday-mode-selector .mode-toggle input[type="radio"] {
    display: none;
}

.multiday-mode-selector .mode-toggle i {
    font-size: 14px;
    color: #6c757d;
    transition: color 0.15s ease;
}

.multiday-mode-selector .mode-toggle.active i {
    color: #007bff;
}

.multiday-mode-selector .mode-toggle .mode-name {
    font-size: 9px;
    font-weight: 600;
    color: #555;
    line-height: 1.1;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.multiday-mode-selector .mode-toggle.active .mode-name {
    color: #007bff;
}

/* Preview compact unique */
.mode-preview-compact {
    font-size: 10px;
    color: #28a745;
    background: rgba(40, 167, 69, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    margin-top: 5px;
    text-align: center;
    display: none;
}

.mode-preview-compact.visible {
    display: block;
}

.mode-preview-compact.invalid {
    color: #dc3545;
    background: rgba(220, 53, 69, 0.1);
}

.mode-preview-compact .fa {
    margin-right: 5px;
}

/* Warning pour dates invalides - COMPACT */
.multiday-warning {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 4px;
    margin-top: 4px;
    font-size: 10px;
    color: #856404;
}

.multiday-warning.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.multiday-warning .fa {
    margin-right: 6px;
    flex-shrink: 0;
}

/* Couleurs des icones selon le mode */
#option_shift i { color: #007bff; }
#option_adjust_start i { color: #fd7e14; }
#option_adjust_end i { color: #28a745; }

#option_shift.active i { color: #0056b3; }
#option_adjust_start.active i { color: #e65c00; }
#option_adjust_end.active i { color: #1e7e34; }

/* Responsive pour popup multi-jours */
@media (max-width: 480px) {
    #multiday_choice_section {
        padding: 8px 0;
    }

    .multiday-mode-selector {
        gap: 4px;
    }

    .multiday-mode-selector .mode-toggle {
        padding: 6px 2px;
    }

    .multiday-mode-selector .mode-toggle i {
        font-size: 14px;
    }

    .multiday-mode-selector .mode-toggle .mode-name {
        font-size: 9px;
    }

    .mode-preview-compact {
        font-size: 10px;
        padding: 5px 8px;
    }
}

/* ============================================
   POPUP DRAG & DROP - VIEWPORT AWARE (COMPACT)
   ============================================ */

/* Styles pour la popup de choix drag & drop */
#divChoixDragNDrop {
    /* Position fixed geree par JS */
    position: fixed !important;
    z-index: 10000;
    /* Largeur compacte */
    min-width: 240px;
    max-width: min(85vw, 320px);
    /* Pas de scroll par defaut - le JS gere ca */
    overflow: visible;
}

/* Quand la popup a besoin de scroll interne (cas rare: popup > viewport) */
#divChoixDragNDrop.needs-scroll {
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

#divChoixDragNDrop.needs-scroll::-webkit-scrollbar {
    width: 5px;
}

#divChoixDragNDrop.needs-scroll::-webkit-scrollbar-track {
    background: transparent;
}

#divChoixDragNDrop.needs-scroll::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 3px;
}

/* Animation flip vers le haut */
#divChoixDragNDrop.flipped {
    animation: popupSlideUp 0.15s ease-out;
}

@keyframes popupSlideUp {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
