/**
 * Styles globaux de l'application Extranet V2.
 *
 * Ce fichier centralise les styles CSS fondamentaux appliqués à l'ensemble de l'application.
 * Il inclut la typographie de base, les styles des éléments HTML génériques (body, a, li),
 * les classes utilitaires (hidden, center, spinner), les styles des boutons,
 * les styles pour les modales et dialogues, les notifications, les barres de progression,
 * les surcharges pour CKEditor, les styles des barres de défilement,
 * et les styles globaux pour la bibliothèque FullCalendar.
 */

/* ==========================================================================
   1. Styles globaux de base
   ========================================================================== */

@import url('https://fonts.googleapis.com/css?family=Raleway:400,700');

html,body{
    height: 100%;
}

body{
    font-family: Raleway, sans-serif; /* Police de caractères principale */
    background: linear-gradient(45deg, #bebdc708 10%,transparent 10%,transparent 90%,#bebdc708 90%),linear-gradient(135deg, transparent 40%, #bebdc706 40%, #bebdc706 60%, transparent 0),linear-gradient(45deg, transparent 40%, #bebdc704 40%, #bebdc704 60%, transparent 0);
    background-size: 3em 3em;
    opacity: 1;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    max-width: 100vw;
}

@media (max-width: 50rem) { /* 800px */
    body{
        font-size: 0.8em;
    }
}

*{
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /*letter-spacing: 1px;*/
    color: #333;
}

li, ol{ /* ol ajouté pour la cohérence */
    list-style: none;
}

a{
    text-decoration: none;
    color: rgba(25, 143, 130, 0.68);
}

.hidden{
    display: none!important;
}

main{ /* Ajouté depuis header.css */
    flex-basis: 80%;
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: hidden;
    height: 100%;
}

[class^="main"] h1{ /* Ajouté depuis header.css */
    text-align: center;
    margin: 0.25em 0 0.5em 0;
}

/* ==========================================================================
   2. Styles des boutons
   ========================================================================== */

.btn{
    width: fit-content;
    cursor: pointer;
    border: none;
    background-color: #00000000;
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0.5em 1em;
    gap: 0.5em;
    font-size: 80%;
}

a.btn{
    font-size: 80%;
}

.btn-primary{
    background-color: #0B70B6;
    color: #efefef;
    border-radius: 0.3125rem; /* 5px */
}

.btn-primary:hover{
    background-color: #0056b3;
}

.btn-success {
    background-color: #28a745;
    color: #efefef;
    border-radius: 0.3125rem; /* 5px */
}

.btn-success:hover {
    background-color: #218838;
}

.btn-danger{
    background-color: #e22b37;
    color: #efefef;
    border-radius: 0.3125rem; /* 5px */
}

.btn-danger:hover{
    background-color: #b31a26;
}

.btn-toggle{
    display: inline-block;
    padding: 0.625rem 1.25rem; /* 10px 20px */
    margin-right: 0.625rem; /* 10px */
    text-decoration: none;
    color: #333;
    background-color: #f0f0f000;
    border: 1px solid #ccc;
    border-radius: 0.25rem; /* 4px */
    transition: background-color 0.3s ease;
}

.btnSupprimer{
    background-color: red;
    border: 1px solid #333;
    height: min-content;
    color: #efefef;
    font-weight: bold;
    padding: 1vw;
    border-radius: 0.3125rem; /* 5px */
    cursor: pointer;
    transition: 0.3s;
}

.btnAjouter{
    background-color: #2AAF52;
    border: 1px solid #333;
    color: #efefef;
    border-radius: 0.3125rem; /* 5px */
    cursor: pointer;
    transition: 0.3s;
}

/* ==========================================================================
   3. Styles spécifiques à Fancybox
   ========================================================================== */

.fancybox__container *{
    color: var(--f-button-color);
}

a[data-fancybox] iframe {
    pointer-events: none;
}

/* ==========================================================================
   4. Styles des modales et dialogues (utilisés par modal_controller et dialog_controller)
   ========================================================================== */

/* Styles de base pour le conteneur de la modale */
.modal {
    position: fixed;
    z-index: 1040;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

/* Rend la modale visible */
.modal-visible {
    opacity: 1;
    visibility: visible;
}

/* Styles pour le contenu de la modale (la boîte de dialogue elle-même) */
.modal-dialog {
    position: absolute;
    background-color: #fff;
    border-radius: 0.375rem; /* 6px */
    box-shadow: 0 0.3125rem 0.9375rem rgba(0,0,0,.5); /* 5px 15px */
    width: auto;
    max-width: fit-content;
    display: flex;
    flex-direction: column;
    z-index: 50;
    pointer-events: auto;
    border: 2px outset rgb(68, 68, 68);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* En-tête de la modale (zone de glisser-déposer) */
.modal-header {
    flex-shrink: 0;
    padding: 0.625rem 0.9375rem; /* 10px 15px */
    background-color: #f1f1f1;
    border-bottom: 1px solid #ddd;
    border-top-left-radius: 0.375rem; /* 6px */
    border-top-right-radius: 0.375rem; /* 6px */
    cursor: grab;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header span {
    font-weight: bold;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Bouton de fermeture de la modale */
.modal-close {
    font-size: 1.2rem;
    line-height: 1;
    padding: 0 0.3125rem; /* 5px */
    color: #666;
    cursor: pointer;
    top: auto !important;
}
.modal-close:hover {
    opacity: 1;
    color: #000;
}

/* Contenu principal de la modale */
.modal-content {
    position: relative;
    flex-grow: 1;
    user-select: text;
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    max-height: 90dvh;
    overflow-x: scroll;
    resize: both;
    display: flex;
    flex-direction: column;
}

/* Message d'erreur dans la modale */
.modal-error {
    flex-shrink: 0;
    color: red;
    font-size: 0.9em;
}

/* Curseur lors du glisser-déposer de la modale */
.modal-header:active,
body.modal-dragging {
    cursor: grabbing !important;
}

/* Styles pour l'élément <dialog> HTML5 */
body:has(dialog[data-dialog-target='dialog'][open]) {
    overflow: hidden;
}

dialog{
    position: fixed;
    box-shadow: 0 0 0 100vw rgb(0 0 0 / 0.5);
    border-radius: 0.625rem; /* 10px */
    border: none;
    width: fit-content;
    max-width: 90dvw;
    height: fit-content;
    max-height: 80dvh;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    z-index: 1000;
    padding: 0;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Media queries pour les tailles de dialogue sur petits écrans */
@media (max-width: 80rem) and (pointer: coarse) { /* 1280px */
    .dialog-size--small { min-height: 25dvh; }
    .dialog-size--medium { min-height: 40dvh; }
    .dialog-size--large { min-height: 60dvh; }
    .dialog-size--xlarge { min-height: 75dvh; }
}

/* Réinitialisation des transitions et animations pour les inputs dans les dialogues */
dialog input,
dialog textarea {
    transition: none !important;
    animation: none !important;
}

/* Styles pour le contenu interne des dialogues */
dialog turbo-frame, .dialog {
    display: flex;
    flex-direction: column;
    gap: 1em;
    width: 100%;
    height: 100%;
    overflow-y: auto;
    padding: 1.25em;
}

.dialog h2 {
    text-align: center;
}

/* Styles pour les dialogues ouverts */
dialog[data-dialog-target='dialog'][open] {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1em;
}

dialog[data-dialog-target='dialog'][open] .confirmation {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    gap: 1em;
}

dialog[data-dialog-target='dialog'][open] p {
    text-align: center;
    line-height: 2em;
    color: #333333;
}

/* Animations d'entrée et de sortie pour les dialogues */
@keyframes fade-in {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes fade-out {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

dialog[data-dialog-target='dialog'][open] {
    animation: fade-in 200ms forwards;
}

dialog[data-dialog-target='dialog'][closing] {
    animation: fade-out 200ms forwards;
}

/* En-tête spécifique pour les dialogues */
.dialog_header{
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
}


/* Styles pour les listes dans les dialogues */
.dialog ul{
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
}

.dialog ul li{
    display: flex;
    width: calc(100% / 3);
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.dialog ul li a{
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0.5em;
}

.dialog h4{
    text-align: center;
    overflow: hidden;
}

/* ==========================================================================
   5. Classes utilitaires générales
   ========================================================================== */

.center{
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.spinner{
    width: 75%;
}

/* ==========================================================================
   6. Notifications globales (utilisées par notification_controller)
   ========================================================================== */

#notifications-wrapper {
    position: fixed;
    top: 1.25rem; /* 20px */
    right: 1.25rem; /* 20px */
    width: 100%;
    max-width: 18.75rem; /* 300px */
    z-index: 99999;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.625rem; /* 10px */
}

.notification-container {
    width: 100%;
    color: #ffffff;
    border-radius: 0.375rem; /* 6px */
    padding: 1rem 1.25rem; /* 16px 20px */
    box-shadow: 0 0.3125rem 0.9375rem rgba(0, 0, 0, 0.2); /* 5px 15px */
    display: flex;
    align-items: flex-start;
    opacity: 1;
    transition: opacity 0.4s ease-in-out, transform 0.4s ease-in-out;
}

.notification-container.notification-success { background-color: #28a745; }
.notification-container.notification-danger { background-color: #dc3545; }
.notification-container.notification-warning { background-color: #ffc107; color: #333; }
.notification-container.notification-warning .notification-close-button { color: rgba(0, 0, 0, 0.5); }
.notification-container.notification-warning .notification-close-button:hover { color: rgba(0, 0, 0, 0.8); }
.notification-container.notification-info { background-color: #17a2b8; }

.notification-content {
    flex-grow: 1;
    margin-right: 0.9375rem; /* 15px */
}

.notification-message {
    margin: 0;
    padding: 0;
    font-size: 1rem;
    line-height: 1.5;
    font-weight: 500;
    color: #ffffff;
}
.notification-container.notification-warning .notification-message {
    color: #333;
}


.notification-close-button {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.8rem;
    line-height: 1;
    padding: 0;
    cursor: pointer;
    margin-top: -0.1875rem; /* -3px */
    transition: color 0.2s ease-in-out;
}

.notification-close-button:hover {
    color: #ffffff;
}
.notification-container.notification-warning .notification-close-button:hover {
    color: rgba(0, 0, 0, 0.8);
}

/* Animations pour les notifications */
.notification-enter-from,
.notification-leave-to {
    opacity: 0;
    transform: translateY(-1.25rem); /* -20px */
}

.notification-enter-to,
.notification-leave-from {
    opacity: 1;
    transform: translateY(0);
}

/* ==========================================================================
   7. Messages flash basiques
   ========================================================================== */

.alert {
    padding: 0.625rem; /* 10px */
    color: white;
    margin-bottom: 0.9375rem; /* 15px */
    border-radius: 0.625rem; /* 10px */
}

.alert-danger { background-color: #f44336; }
.alert-success { background-color: #4CAF50; }


/* ==========================================================================
   8. Barres de progression
   ========================================================================== */

.progress-container {
    width: 100%;
    background-color: #f3f3f3;
    border-radius: 1.5625rem; /* 25px */
    margin-top: 0.625rem; /* 10px */
    height: 1.25rem !important; /* 20px */
    position: relative;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background-color: #4caf50;
    border-radius: 1.5625rem; /* 25px */
    text-align: center;
    line-height: 1.25rem; /* 20px */
    color: white;
}

/* ==========================================================================
   9. Styles des inputs et focus
   ========================================================================== */

/* Suppression de l'effet de focus par défaut */
input:focus,
textarea:focus,
select:focus,
button:focus {
    outline: none;
    box-shadow: none;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #0B70B6;
}

/* ==========================================================================
   10. Styles pour CKEditor
   ========================================================================== */

.ckeditor-content * {
    display: revert;
    color: revert;
    letter-spacing: revert;
    margin: revert;
    padding: revert;
    box-sizing: revert;
}

.ckeditor-content p,
.ckeditor-content ol,
.ckeditor-content ul,
.ckeditor-content li,
.ckeditor-content h1, .ckeditor-content h2, .ckeditor-content h3, .ckeditor-content h4, .ckeditor-content h5, .ckeditor-content h6 {
    padding: 0;
    margin-bottom: 0;
}

.ckeditor-content img{
    max-width: 100%;
}

.ckeditor-content ol {
    padding-left: 2.5em;
    list-style-type: decimal;
}

.ckeditor-content ul {
    padding-left: 2.5em;
    list-style-type: disc;
}

.ckeditor-content ol li,
.ckeditor-content ul li {
    margin-bottom: 0.5em;
    list-style-type: inherit;
}


/* ==========================================================================
   11. Styles des barres de défilement (scrollbars)
   ========================================================================== */

::-webkit-scrollbar {
    width: 0.375rem; /* 6px */
    height: 0.375rem; /* 6px */
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 0.1875rem; /* 3px */
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.3);
}

/* Pour Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

/* Pour IE et Edge */
body {
    -ms-overflow-style: -ms-autohiding-scrollbar;
}


/* ==========================================================================
   12. Styles globaux pour FullCalendar
   ========================================================================== */

/* Style de base pour la vue active du calendrier, largeur par défaut de planningPointages */

.fc-icon-chevron-left::before,
.fc-icon-chevron-right::before {
    color: #efefef !important;
}

.fc-button-primary {
    background-color: #0B70B6 !important;
}

.fc-button-primary:hover {
    background-color: #0056b3 !important;
}

.fc-event-title {
    display: flex;
    justify-content: center;
    align-items: center;
}

.fc-daygrid-day-events:before,
.fc-daygrid-day-events:after {
    content: none !important;
}

.fc-event-main {
    color: #333 !important;
    white-space: pre-line;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

@media screen and (max-width: 31.25rem) { /* 500px */
    .fc-datagrid-cell {
        width: fit-content;
    }

    .fc-daygrid-week-number {
        display: none;
    }

    .fc-button {
        font-size: 0.8em !important;
    }

    .fc-scrollgrid-sync-inner {
        font-size: 80% !important;
    }

    .fc-scrollgrid-sync-inner .fc-icon,
    .fc-scrollgrid-sync-inner .fc-datagrid-expander-placeholder {
        display: none;
    }

    .fc-toolbar-title {
        font-size: 1.3em !important;
    }

    .fc-event-title {
        font-size: 1.1em;
    }
}

/* ==========================================================================
   13. Styles pour les aperçus de fichiers
   ========================================================================== */

.file-preview-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1em;
    margin-top: 1em;
}

.file-preview-item {
    position: relative;
    border: 1px solid #eee;
    border-radius: 0.3125rem; /* 5px */
    overflow: hidden;
}

/* Taille par défaut pour les vidéos (grande) */
.file-preview-item.file-type-video {
    width: calc(33.333% - 1em);
}

/* Taille réduite pour les images et PDF */
.file-preview-item.file-type-image,
.file-preview-item.file-type-pdf {
    width: 9.375rem; /* Équivalent à 150px avec une base de 16px */
    height: 9.375rem; /* Équivalent à 150px avec une base de 16px */
}

.file-preview-item a {
    display: block;
    width: 100%;
    height: 100%;
}

.file-preview-item img,
.file-preview-item iframe, /* Pour les PDF */
.file-preview-item video {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Assure que le contenu remplit l'espace */
    display: block;
}
