﻿/* Conteneur général */
.planified-task-container {
    display: flex;
    height: 100%;
    gap: 1rem;
    padding: 1rem;
}

/* Cible d'un remplacement (élément avec lequel on souhaite échanger) */
.planified-task-item.replacement-target {
    box-shadow: 0 0 0 4px var(--important-color), 0 3px 10px rgba(0, 0, 0, 0.5);
}
/* Éléments de la liste */
.planified-task-item-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 70px;
    border-radius: 6px;
    background-color: var(--primary-color);
    color: var(--secondary-color);
    cursor: pointer;
    overflow: hidden;
    position: relative;
    gap: 0.5rem;
    width: 100%;
}

    .planified-task-item-container:hover {
        background-color: var(--primary-color-hover, #143260);
    }

    .planified-task-item-container.selected {
        outline: 5px solid var(--important-color);
    }


.planified-task-item-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0 0.5rem;
    margin: 0.5rem 0;
}

.planified-task-item-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex-grow: 1;
    height: 100%;
    overflow: hidden;
    gap: 0.25rem;
}

.planified-task-item-label-wrapper {
    flex: 1;
    display: flex;
    align-items: center; /* ✅ Centre verticalement */
    justify-content: center; /* ✅ Centre horizontalement */
}

.planified-task-item-label {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: bold;
    text-transform: uppercase;
    font-size: 1rem;
    line-height: 1;
    text-align: center;
}

/* -------------------- Assignements Items -------------------- */
.planified-task-grid {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    height: 100%;
    max-height: 100%;
    gap: 1.5rem;
    overflow-x: visible;
    align-content: flex-start;
    overflow: visible; /* Pour éviter que le hover soit tronqué */
    position: relative; /* Nécessaire si des enfants utilisent position:absolute */
    z-index: 1; /* Pour garantir que les enfants ont une base correcte */
    padding:1rem;
}

/* ---- CARD ---- */
.planified-task-item-assignement-container {
    position: relative;
    overflow: visible; /* ← permet à la popup de dépasser */
}

.planified-task-item {
    border-radius: 10px;
    background-color: rgba(var(--primary-color-rgb), 0.3);
    color: var(--primary-color);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    gap: 0.5rem;
    position: relative;
    transition: transform 0.2s ease;
    width: 240px;
    overflow: visible; /* pour éviter les débordements visuels */
    text-align: center;
    word-wrap: break-word;
    box-sizing: border-box;
    justify-content: space-evenly;
    gap: 0.25rem;
}

    .planified-task-item:hover {
        transform: scale(1.05);
        transition: transform 0.2s ease;
        z-index: 10;
    }

    /* Taille par granularité */
    .planified-task-item.daily {
        height: 140px;
        font-size: 0.85rem;
    }

    .planified-task-item.weekly {
        height: 160px;
        font-size: 1rem;
    }

    .planified-task-item.monthly {
        height: 180px;
        font-size: 1.1rem;
    }

/* Classes spécifiques */
.planified-task-date {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.planified-task-classroom {
    font-size: 1.6rem;
    font-weight: 700;
    text-transform: uppercase;
    word-break: break-word;
}


.planified-task-header {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    flex-wrap: wrap;
}


/* Semaine en haut à gauche */
.planified-task-week-label {
    position: absolute;
    top: 6px;
    left: 10px;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--secondary-color);
}

/* Passé */
.planified-task-item.past {
    background-color: #e0e0e0;
    color: #666;
    opacity: 0.6;
}

/* Période courante */
.planified-task-item.current {
    outline: 3px solid var(--secondary-color);
    outline-offset: -2px;
    background-color: rgba(var(--primary-color-rgb), 0.18);
    opacity: 1;
}

    .planified-task-item.current::after {
        content: "EN COURS";
        position: absolute;
        bottom: 8px;
        right: 8px;
        font-size: 0.7rem;
        font-weight: 800;
        letter-spacing: 0.04em;
        padding: 2px 8px;
        border-radius: 999px;
        background-color: var(--secondary-color);
        color: white;
    }

/* ---- Cartes vacances ---- */
.planified-task-item.vacation {
    background-color: #edf6ff;
    border: 2px dashed #80bfff;
    color: #0a5a99;
    justify-content: center;
}

.planified-task-item.holiday {
    background-color: #fff0f0;
    border: 2px dashed #ffb3b3;
    color: #d11a1a;
    justify-content: center;
}

/* ---- Icône flottante ---- */
.planified-task-icon {
    position: absolute;
    font-size: 1.2rem;
    opacity: 0.85;
}

    .planified-task-icon.top-left {
        top: 8px;
        left: 8px;
    }

    .planified-task-icon.top-right {
        top: 8px;
        right: 8px;
    }

.planified-task-item.holiday .planified-task-icon,
.planified-task-item.vacation .planified-task-icon {
    color: var(--secondary-color);
}

.planified-task-item .bi-exclamation-triangle-fill {
    color: #ffa600;
}

.planified-task-holiday-label,
.planified-task-vacation-label {
    font-size: 1rem;
    font-weight: bold;
    text-align: center;
    padding: 0.25rem;
}

/* ----- Mode remplacement ----- */

.replacement-selection-header {
    padding: 1rem;
    background-color: var(--bs-light);
    border: 1px solid #ccc;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

    .replacement-selection-header strong {
        color: var(--primary-color);
    }

.replacement-icon-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 0.3rem;
    cursor: pointer;
}

    .replacement-icon-button:disabled {
        background-color: #ccc;
        cursor: not-allowed;
    }

    .replacement-icon-button i {
        font-size:0.85rem;
    }

    /* popup */

/* Bulle remplacement */

.replacement-popup-content {
    position: absolute;
    top: 0;
    right: 100%;
    margin: 0.5rem;
    z-index: 100;
    width: 300px;
    background: white;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
    border: 1px solid var(--secondary-color);
    border-radius: 8px;
    padding: 1rem;
    animation: fadeIn 0.2s ease-in-out;
}

.replacement-popup-message {
    font-weight: bold;
    margin-bottom: 0.5rem;
    text-align: center;
}

.replacement-popup-source {
    margin-bottom: 0.5rem;
    pointer-events: none;
    opacity: 0.7;
}

/* Icône bouton */
.replacement-icon-button {
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 1.2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    background-color: rgba(var(--bs-secondary-rgb), var(--bs-bg-opacity)) !important;
    --bs-bg-opacity: 1;
    cursor: pointer;
    transition: background-color 0.2s ease-in-out;
}

    .replacement-icon-button.bg-success {
        background-color: var(--confirm-color) !important;
    }

    .replacement-icon-button.bg-danger {
        background-color: var(--important-color) !important;
    }

    .replacement-icon-button.bg-secondary {
        background-color: var(--secondary-color) !important;
    }

    .replacement-icon-button:hover {
        filter: brightness(1.1);
    }

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Cartes cliquables en mode sélection de remplacement */
.planified-task-item.clickable {
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}

    /* Effet au clic (mousedown) */
    .planified-task-item.clickable:active {
        transform: scale(0.96);
        box-shadow: 0 0 0 4px var(--important-color), 0 3px 10px rgba(0, 0, 0, 0.5);
        background-color: rgba(var(--primary-color-rgb), 0.4);
    }

    /* Optionnel : focus clavier (tab) cohérent avec le clic */
    .planified-task-item.clickable:focus-visible {
        outline: none;
        box-shadow: 0 0 0 3px var(--important-color), 0 3px 10px rgba(0, 0, 0, 0.5);
    }
