/* Variables globales et thème */
:root {
    --primary-color: #0066cc;
    --primary-hover: #0052a3;
    --success-color: #10b981;
    --success-hover: #059669;
    --danger-color: #ef4444;
    --danger-hover: #dc2626;
    --background-color: #f3f4f6;
}

/* Pour le header principal */
.app-header {
    z-index: 1010;
    background: white;
}

/* Bootstrap Modals - Force au-dessus du header principal (z-index: 9999) */
.modal-backdrop {
    z-index: 10050 !important;
}

.modal {
    z-index: 10055 !important;
}

/* Hero section avec icône animée */
.hero-icon {
    width: 60px;
    height: 60px;
    margin-right: 1rem;
    animation: float 3s ease-in-out infinite;
}

/* Styles de base */
body {
    font-family: 'Inter', 'Segoe UI', Roboto, sans-serif;
    background-color: var(--background-color);
    color: #1f2937;
}

/* Header et Navigation */
.navbar {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 0.75rem 0;
}

.navbar-brand img {
    transition: transform 0.2s ease;
}

.navbar-brand img:hover {
    transform: scale(1.05);
}

.nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
    color: #333;
    transition: color 0.3s ease;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Style pour les deux menus déroulants */
.language-selector,
.profile-dropdown {
    position: relative;
    z-index: 1020;
}

/* Style spécifique pour le menu déroulant du profil */
.profile-dropdown .dropdown-menu {
    position: absolute;
    z-index: 1020;
    margin-top: 0.5rem;
}

/* Language Selector */
.language-selector {
    min-width: 80px;
}

.language-selector select {
    appearance: none;
    padding: 0.4rem 2rem 0.4rem 2.5rem;
    background-color: #fff;
    border: 1px solid #ced4da;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 20px;
}

/* Flag backgrounds */
.language-selector select.flag-fr {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Cpath fill='%23EC1920' d='M2 0h1v2H2z'/%3E%3Cpath fill='%23FFF' d='M1 0h1v2H1z'/%3E%3Cpath fill='%23051440' d='M0 0h1v2H0z'/%3E%3C/svg%3E");
}

.language-selector select.flag-en {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Crect fill='%23012169' width='10' height='6'/%3E%3Cpath stroke='%23FFFFFF' stroke-width='1' d='M0,0 L10,6 M10,0 L0,6'/%3E%3Cpath stroke='%23C8102E' stroke-width='.67' d='M0,0 L10,6 M10,0 L0,6'/%3E%3Cpath stroke='%23FFFFFF' stroke-width='2' d='M5,0 L5,6 M0,3 L10,3'/%3E%3Cpath stroke='%23C8102E' stroke-width='1' d='M5,0 L5,6 M0,3 L10,3'/%3E%3C/svg%3E");
}

.language-selector select.flag-es {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 2'%3E%3Cpath fill='%23AA151B' d='M0 0h3v2H0z'/%3E%3Cpath fill='%23F1BF00' d='M0 .5h3v1H0z'/%3E%3C/svg%3E");
}

/* Quiz Fixed Header */
.quiz-fixed-header {
    position: sticky;
    top: 0;
    background: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 1rem 0;
    z-index: 1000;
    margin-top: 0;
}

.quiz-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #1f2937;
}

.hover-elevate {
    transition: all 0.2s ease;
}

.hover-elevate:hover {
    transform: translateY(-5px);
}

/* Carousel accueil */
.carousel-image-container {
    width: 100%;
    height: auto;
    max-height: 600px; /* Ajustez cette valeur selon vos besoins */
    overflow: hidden;
    background-color: rgba(0,0,0,0.02);
    border-radius: 8px;

}

.carousel-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.ribbon {
    position: absolute;
    right: -5px;
    top: -5px;
    z-index: 1;
    overflow: hidden;
    width: 75px;
    height: 75px;
    text-align: right;
}

.ribbon span {
    font-size: 10px;
    font-weight: bold;
    color: #FFF;
    text-transform: uppercase;
    text-align: center;
    line-height: 20px;
    transform: rotate(45deg);
    -webkit-transform: rotate(45deg);
    width: 100px;
    display: block;
    background: #79A70A;
    background: linear-gradient(#9BC90D 0%, #79A70A 100%);
    box-shadow: 0 3px 10px -5px rgba(0, 0, 0, 1);
    position: absolute;
    top: 19px;
    right: -21px;
}

/* Quiz Content Structure */
.quiz-content {
    margin-top: 0;
    padding-top: 0;
}

.quiz-form-container {
    background: #fff;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    margin-top: 0;
}

.quiz-section {
    background: #fff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.quiz-section:last-child {
    margin-bottom: 0;
}

/* déplier / replier quiz questions */
.question-header {
    cursor: pointer;
}
.question-header:hover {
    background-color: rgba(0,0,0,0.05);
}
.question-toggle {
    transition: transform 0.2s;
}
.question-header[aria-expanded="true"] .question-toggle {
    transform: rotate(180deg);
}

/* Form Elements */
.form-control {
    border-radius: 0.75rem;
    border-color: #dee2e6;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.1);
}

/* style pour les radio Boutons */
.form-check {
    margin-right: var(--bs-spacing-3);
}

/* Styles de base pour tous les textareas */
textarea,
.form-textarea-lg,
.form-textarea-md,
.form-textarea-sm,
.form-textarea-base {
    width: 100%;
    padding: 0.75rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: #212529;
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 0.75rem;
    transition: all 0.2s ease-in-out;
    resize: vertical;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

textarea:focus,
.form-textarea-lg:focus,
.form-textarea-md:focus,
.form-textarea-sm:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.1);
    outline: none;
}

.form-textarea-lg,
.form-textarea-md,
.form-textarea-sm {
    min-height: 80px;
}

/* Style pour les labels */
.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #1f2937;
}

/* Questions et Choix */
.question-item {
    background: #f8f9fa;
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.choice-item {
    background: white;
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

/* Score, duration et points sections */
/*.duration-section,*/
/*.score-section,*/
.points-section {
    background-color: rgba(0, 102, 204, 0.05);
    padding: 0.5rem;
    border-radius: 0.5rem;
    border-left: 2px solid var(--primary-color);
    border-right: 2px solid var(--primary-color);
}

/* Styles spécifiques pour les inputs dans les compteurs */
/*.duration-section input,*/
/*.score-section input,*/
.points-section input {
    height: 24px;
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
    border-radius: 0.25rem;
    width: 60px;
    text-align: center;
    background-color: white;
}

/* Styles pour les boutons des compteurs */
/*.duration-section .btn-sm,*/
/*.score-section .btn-sm,*/
.points-section .btn-sm {
    padding: 0 0.5rem;
    height: 24px;
    display: inline-flex;
    align-items: center;
    font-size: 0.875rem;
    background-color: white;
}

/*.duration-section i.bi-clock,*/
/*.score-section i.bi-trophy,*/
.points-section i.bi-trophy {
    font-size: 1rem;
}

.points-section .form-label,
/*.duration-section .form-label*/
/*.score-section .form-label */
{
    margin-bottom: 0;
    font-size: 0.875rem;
}

/* Styles pour le conteneur du slider et ses graduations */
/* Styles communs pour les deux sections */
.duration-section,
.score-section {
    background-color: rgba(0, 102, 204, 0.05);
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    border-left: 2px solid var(--primary-color);
}

/* Durée */
.duration-section {
    width: 100%;  /* Prend toute la largeur de sa colonne */
    min-height: 140px;
}

.duration-input-group {
    width: fit-content;  /* S'adapte au contenu */
    max-width: 150px;
}

.duration-input-group .form-control {
    min-width: 60px;  /* Assurer une largeur minimale pour le champ de saisie */
    max-width: 80px;  /* Largeur max pour 3 chiffres */
    flex: 1 1 auto;
}

.duration-input-group .btn {
    height: 100%;  /* Même hauteur que le champ */
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;  /* Largeur minimale pour les boutons */
}

/* Score */
.score-section {
    width: 100%;  /* Prend toute la largeur de sa colonne */
    min-height: 140px;
}

.score-widget-wrapper {
    max-width: 180px;  /* Limite la largeur du widget score */
}

.percentage-input-group {
    width: 85px;
    min-width: 85px;
}

/* Style des champs d'entrée */
#percentageValueInput {
    font-weight: 500;
    padding-right: 0.25rem;
}

/* Supprimer les flèches des champs numériques avec boutons +/- */
#percentageValueInput::-webkit-inner-spin-button,
#percentageValueInput::-webkit-outer-spin-button,
.points-input::-webkit-inner-spin-button,
.points-input::-webkit-outer-spin-button,
.duration-input-group .form-control::-webkit-inner-spin-button,
.duration-input-group .form-control::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

#percentageValueInput,
.points-input,
.duration-input-group .form-control {
    -moz-appearance: textfield;
}

/* Classe utilitaire pour désactiver les spinners sur tous les champs numériques avec +/- */
.no-spinner::-webkit-inner-spin-button,
.no-spinner::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.no-spinner {
    -moz-appearance: textfield;
}

/* Wrapper du slider pour contrôler sa largeur */
.slider-wrapper {
    width: 100%;
    padding: 0 2px;
}

/* Ligne de graduation */
.graduation-line {
    padding: 0 2px;
    margin-bottom: 4px;
}

/* Style des textes d'information */
.score-section .fst-italic [title],
.duration-section .fst-italic [title] {
    cursor: help;
    border-bottom: 1px dotted #ccc;
}

/* Style des icônes d'information */
.bi-info-circle {
    color: #6c757d;
    font-size: 0.875rem;
}


/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: 0.5rem;
    transition: all 150ms ease-in-out;
    cursor: pointer;
    gap: 0.5rem;
}

.btn i, 
.btn svg {
    margin-right: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: #fff;
    border: 1px solid transparent;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: var(--success-hover);
    border-color: var(--success-hover);
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
    border: 1px solid transparent;
}

.btn-danger:hover {
    background-color: var(--danger-hover);
}

.btn-outline-secondary {
    background-color: transparent;
    border: 1px solid #ced4da;
    color: #6b7280;
}

.btn-outline-secondary:hover {
    background-color: #f3f4f6;
    color: #374151;
}

/* Actions */
.quiz-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.correct-choice {
    background-color: rgba(13, 110, 253, 0.05);
    border-radius: 4px;
}

.choice-item {
    transition: background-color 0.2s ease;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.choice-content {
    font-size: 0.95rem;
}

.timer-container {
    min-width: 200px;
}

.progress {
    background-color: #e9ecef;
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    transition: width 1s linear;
}

.timer {
    text-align: center;
    font-family: monospace;
    font-size: 1.1em;
    font-weight: bold;
}

.form-check-input:disabled {
    opacity: 1;
    pointer-events: none;
}

/* Amélioration de la visibilité des bordures checkbox/radio pour participants */
.form-check-input {
    border-color: #9ca3af !important; /* Gris plus visible que le gris Bootstrap par défaut */
    border-width: 2px !important; /* Légèrement plus épais pour meilleure visibilité */
}

.form-check-input:focus {
    border-color: var(--primary-color) !important;
    box-shadow: 0 0 0 0.25rem rgba(0, 102, 204, 0.1) !important;
}

.correct-answer-indicator {
    min-width: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.choice-item {
    background-color: white;
}

.choice-item.bg-light {
    background-color: rgba(13, 110, 253, 0.05) !important;
}

.fa-check {
    font-size: 1.2rem;
}

/* Quiz Sessions */
.question-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(255, 255, 255, 0.95);
    z-index: 1050;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.question-overlay-content {
    width: 100%;
    max-width: 1200px;
}

/* Responsive */
@media (max-width: 768px) {
    .quiz-fixed-header .container > div {
        flex-direction: column;
        gap: 1rem;
    }

    .quiz-actions {
        width: 100%;
        flex-direction: column;
    }

    .quiz-actions .btn {
        width: 100%;Super
    }

    .quiz-section {
        padding: 1rem;
    }

    .question-item {
        padding: 1rem;
    }

    input[type="file"].form-control {
        padding: 0.5rem;
        line-height: 1.5;
    }
    
    /* Optionnel: ajout d'une légère animation au survol */
    input[type="file"].form-control:hover {
        border-color: #80bdff;
        box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    }

    /* Styles pour la notification de sauvegarde automatique */
    .auto-save-notification {
        position: fixed;
        bottom: 20px;
        right: 20px;
        display: none;
        align-items: center;
        padding: 12px 20px;
        border-radius: 6px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        color: white;
        z-index: 1050;
        min-width: 250px;
        max-width: 350px;
        transition: opacity 0.3s ease;
    }

    .auto-save-notification .auto-save-icon {
        margin-right: 12px;
        font-size: 1.1rem;
    }

    .auto-save-notification .auto-save-message {
        flex-grow: 1;
        font-size: 0.9rem;
    }

    .auto-save-notification .auto-save-close {
        background: transparent;
        border: none;
        color: white;
        opacity: 0.7;
        cursor: pointer;
        font-size: 1rem;
        padding: 0;
        margin-left: 10px;
    }

    .auto-save-notification .auto-save-close:hover {
        opacity: 1;
    }

    /* Couleurs de notification */
    .auto-save-notification.bg-success {
        background-color: #28a745;
    }

    .auto-save-notification.bg-info {
        background-color: #17a2b8;
    }

    .auto-save-notification.bg-warning {
        background-color: #ffc107;
        color: #212529;
    }

    .auto-save-notification.bg-danger {
        background-color: #dc3545;
    }

    .auto-save-notification.bg-secondary {
        background-color: #6c757d;
    }

    /* Indicateur de sauvegarde en cours pour les questions et choix */
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    .autosave-spinner {
        animation: spin 1.5s linear infinite;
    }
    
    /* Si vous préférez ne pas afficher la notification du bas du tout */
    .auto-save-notification {
        display: none !important;
    }

    .question-item.saving,
    .choice-item.saving {
        position: relative;
    }

    .question-item.saving::before,
    .choice-item.saving::before {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 3px;
        background: linear-gradient(90deg, transparent, #17a2b8, transparent);
        animation: auto-save-pulse 1.5s infinite;
        z-index: 10;
    }

    /* Animation pour l'indicateur de sauvegarde */
    @keyframes auto-save-pulse {
        0% {
            opacity: 0.6;
            transform: scaleX(0);
        }
        50% {
            opacity: 1;
            transform: scaleX(1);
        }
        100% {
            opacity: 0.6;
            transform: scaleX(0);
        }
    }

    /* Bouton de sauvegarde manuelle */
    .manual-save-button {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        font-size: 0.9rem;
        padding: 0.375rem 0.75rem;
        border-radius: 0.25rem;
        background-color: #f8f9fa;
        border: 1px solid #dee2e6;
        color: #495057;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .manual-save-button:hover {
        background-color: #e9ecef;
    }

    .manual-save-button:active {
        background-color: #dee2e6;
    }

    /* Animation du dernier enregistrement */
    .last-save-time {
        font-size: 0.75rem;
        color: #6c757d;
        animation: fadeInOut 1s ease;
    }

    @keyframes fadeInOut {
        0% { opacity: 0; }
        10% { opacity: 1; }
        90% { opacity: 1; }
        100% { opacity: 0.7; }
    }

}

/* Visual indicators for problematic choices in single-choice questions */
.choice-item.choice-warning {
    border-left: 4px solid #ffc107 !important;
    background-color: rgba(255, 193, 7, 0.15) !important;
    border-radius: 0.375rem !important;
}

.choice-item.choice-warning .form-check-label {
    color: #856404 !important;
    font-weight: 500 !important;
}

.choice-warning-badge {
    animation: pulse-warning 2s infinite;
    display: inline-block !important;
}

@keyframes pulse-warning {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* Quiz state card selector - Compact layout for 4 options */
.modal .quiz-state-selector,
div.quiz-state-selector {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    width: 100% !important;
}

.quiz-state-selector .quiz-state-card-compact {
    flex: 1 1 calc(50% - 6px) !important;
    min-width: 200px !important;
    max-width: calc(50% - 6px) !important;
}

.quiz-state-card-compact {
    position: relative;
    border: 2px solid #dee2e6;
    border-radius: 8px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
    min-height: 80px;
}

.quiz-state-card-compact:hover:not(.disabled) {
    border-color: #0d6efd;
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.quiz-state-card-compact.active {
    border-color: #0d6efd;
    background-color: rgba(13, 110, 253, 0.05);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
}

.quiz-state-card-compact.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background-color: #f8f9fa;
}

.quiz-state-compact-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    height: 100%;
}

.quiz-state-label {
    font-weight: 600;
    color: #212529;
    display: block;
    margin-bottom: 4px;
}

.quiz-state-desc {
    color: #6c757d;
    font-size: 0.875rem;
    line-height: 1.3;
    display: block;
}

/* Hide radio inputs */
.quiz-state-input {
    position: absolute;
    clip: rect(0, 0, 0, 0);
    pointer-events: none;
}

/* Responsive: stack on mobile only when very narrow */
@media (max-width: 480px) {
    .quiz-state-selector .quiz-state-card-compact {
        flex: 1 1 100% !important;
        min-width: unset;
    }
}

/* Alternative si la structure DOM est différente */
.form-check.text-warning {
    background-color: rgba(255, 193, 7, 0.1) !important;
    padding: 0.5rem !important;
    border-radius: 0.375rem !important;
    border-left: 3px solid #ffc107 !important;
}