/* ============================================
   DRAS v2 - Styles page création d'activité
   ============================================ */

/* Header modifié */
.app-header {
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-back {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--background);
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

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

.btn-back-text {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: var(--background);
    color: var(--text);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s;
}

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

.btn-secondary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    color: var(--text);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-small);
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.btn-primary:disabled,
.btn-secondary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Indicateur d'étapes */
.steps-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 25px 20px;
    background: var(--white);
    border-bottom: 1px solid #eee;
    gap: 0;
}

.step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 15px;
}

.step-number {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--background);
    color: var(--text-light);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s;
}

.step-label {
    font-size: 0.8rem;
    color: var(--text-light);
    transition: color 0.3s;
}

.step.active .step-number {
    background: var(--primary);
    color: var(--text);
}

.step.active .step-label {
    color: var(--text);
    font-weight: 500;
}

.step.completed .step-number {
    background: var(--primary-dark);
    color: var(--white);
}

.step-line {
    flex: 1;
    height: 2px;
    background: var(--background);
    max-width: 60px;
}

/* Contenu du formulaire */
.main-content {
    padding: 30px;
    padding-bottom: 100px;
}

.form-activite {
    max-width: 800px;
    margin: 0 auto;
}

.form-step {
    display: none;
}

.form-step.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.step-title {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 10px;
}

.step-description {
    color: var(--text-light);
    margin-bottom: 30px;
}

/* Boîte ressource pédagogique */
.ressource-box {
    background: linear-gradient(135deg, #fff8e1 0%, #ffecb3 100%);
    border: 2px solid #ffb300;
    border-radius: 16px;
    padding: 18px 25px;
    margin-bottom: 30px;
    text-align: center;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.25);
    position: relative;
    overflow: hidden;
}

.ressource-box::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.3) 0%, transparent 60%);
    pointer-events: none;
}

.ressource-link {
    color: #e65100;
    text-decoration: none;
    font-size: 1.05rem;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 25px;
    transition: all 0.3s ease;
    position: relative;
}

.ressource-link:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(230, 81, 0, 0.2);
}

.ressource-link strong {
    color: #d84315;
    font-weight: 600;
}

/* Rappel du type de transformation */
.type-reminder {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--background);
    border-radius: 20px;
    margin-bottom: 15px;
    font-size: 0.9rem;
    font-weight: 500;
}

.type-reminder .reminder-icon {
    font-size: 1.1rem;
}

.type-reminder .reminder-text {
    color: var(--text);
}

/* Couleurs par type */
.type-reminder.type-deplacement {
    background: #E3F2FD;
    border: 1px solid #90CAF9;
}

.type-reminder.type-remplacement {
    background: #F3E5F5;
    border: 1px solid #CE93D8;
}

.type-reminder.type-ajout {
    background: #E8F5E9;
    border: 1px solid #A5D6A7;
}

.type-reminder.type-suppression {
    background: #FFEBEE;
    border: 1px solid #EF9A9A;
}

.type-reminder.type-combinaison {
    background: #FFF3E0;
    border: 1px solid #FFCC80;
}

/* Grille des types de transformation */
.transformation-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.transformation-card {
    cursor: pointer;
}

.transformation-card input {
    display: none;
}

.transformation-card .card-content {
    padding: 20px;
    background: var(--white);
    border: 2px solid #eee;
    border-radius: var(--radius);
    text-align: center;
    transition: all 0.2s;
}

.transformation-card:hover .card-content {
    border-color: var(--primary);
}

.transformation-card.selected .card-content,
.transformation-card input:checked + .card-content {
    border-color: var(--primary);
    background: var(--primary);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 10px;
}

.transformation-card h3 {
    font-size: 1.1rem;
    color: var(--text);
    margin-bottom: 5px;
}

.transformation-card p {
    font-size: 0.85rem;
    color: var(--text-light);
    margin: 0;
}

/* Grille de formulaire */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group.centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.form-group.centered select {
    width: auto;
    min-width: 200px;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    font-size: 0.95rem;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

.form-hint {
    font-size: 0.8rem;
    color: var(--text-light);
}

/* Aperçu de la phrase */
.phrase-preview {
    margin-top: 25px;
    padding: 20px;
    background: var(--background);
    border-radius: var(--radius);
}

.phrase-preview h4 {
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 10px;
}

.preview-content {
    font-size: 1.2rem;
    line-height: 2;
}

.preview-content .word {
    display: inline-block;
    padding: 4px 8px;
    margin: 2px;
    background: var(--white);
    border-radius: var(--radius-small);
    border: 1px solid #ddd;
}

.preview-placeholder {
    color: var(--text-light);
    font-style: italic;
}

/* Boîte d'information */
.info-box {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-top: 25px;
    padding: 15px;
    background: #E3F2FD;
    border-radius: var(--radius-small);
    color: #1565C0;
}

.info-box svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box p {
    margin: 0;
    font-size: 0.9rem;
}

/* Liste des phrases de la série */
.phrases-list {
    margin-bottom: 20px;
}

.no-phrases {
    text-align: center;
    padding: 30px;
    color: var(--text-light);
    background: var(--background);
    border-radius: var(--radius);
}

.phrase-item {
    background: var(--white);
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 15px;
    margin-bottom: 15px;
}

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

.phrase-number {
    font-weight: 500;
    color: var(--text);
}

.btn-remove-phrase {
    background: transparent;
    border: none;
    padding: 5px;
    cursor: pointer;
    color: var(--text-light);
    border-radius: var(--radius-small);
    transition: all 0.2s;
}

.btn-remove-phrase:hover {
    background: var(--error-bg);
    color: var(--error);
}

.phrase-item textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    font-size: 0.95rem;
    resize: vertical;
}

.btn-add-phrase {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 15px;
    background: var(--background);
    border: 2px dashed #ddd;
    border-radius: var(--radius);
    color: var(--text-light);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-phrase:hover {
    border-color: var(--primary);
    color: var(--text);
    background: var(--white);
}

/* Récapitulatif */
.recap-card {
    background: var(--white);
    border: 1px solid #eee;
    border-radius: var(--radius);
    overflow: hidden;
}

.recap-section {
    padding: 20px;
}

.recap-section:not(:last-child) {
    border-bottom: 1px solid #eee;
}

.recap-section h4 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin-bottom: 15px;
}

.recap-list {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 10px;
}

.recap-list dt {
    font-weight: 500;
    color: var(--text-light);
}

.recap-list dd {
    color: var(--text);
    margin: 0;
}

/* Options de publication */
.publish-options {
    margin-top: 25px;
}

.publish-options h4 {
    font-size: 1rem;
    margin-bottom: 15px;
}

.visibility-options {
    display: flex;
    gap: 15px;
}

.visibility-option {
    flex: 1;
    cursor: pointer;
}

.visibility-option input {
    display: none;
}

.visibility-option .option-content {
    padding: 15px;
    background: var(--white);
    border: 2px solid #eee;
    border-radius: var(--radius);
    transition: all 0.2s;
}

.visibility-option:hover .option-content {
    border-color: var(--primary);
}

.visibility-option input:checked + .option-content {
    border-color: var(--primary);
    background: var(--primary);
}

.visibility-option strong {
    display: block;
    margin-bottom: 4px;
}

.visibility-option span {
    font-size: 0.85rem;
    color: var(--text-light);
}

/* Footer fixe */
.form-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: var(--white);
    border-top: 1px solid #eee;
    box-shadow: 0 -2px 10px var(--shadow);
}

.form-footer .btn-primary,
.form-footer .btn-secondary {
    flex: 0 0 auto;
    width: auto;
    max-width: 200px;
}

/* Responsive */
@media (max-width: 768px) {
    .steps-indicator {
        padding: 15px 10px;
        overflow-x: auto;
    }

    .step {
        padding: 0 8px;
    }

    .step-label {
        font-size: 0.7rem;
    }

    .step-line {
        max-width: 30px;
    }

    .main-content {
        padding: 20px 15px;
        padding-bottom: 100px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .transformation-grid {
        grid-template-columns: 1fr;
    }

    .visibility-options {
        flex-direction: column;
    }

    .recap-list {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .recap-list dt {
        margin-top: 10px;
    }

    .form-footer {
        padding: 15px;
        gap: 10px;
    }

    .btn-primary,
    .btn-secondary {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
}

/* ============================================
   Nouveaux styles - Éditeur de phrase
   ============================================ */

/* Phrase input row */
.phrase-input-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
}

.phrase-input-row textarea {
    flex: 1;
}

.phrase-input-row .btn-secondary {
    white-space: nowrap;
}

/* Éditeur de mots */
.mots-editor {
    margin-top: 25px;
    padding: 20px;
    background: var(--background);
    border-radius: var(--radius);
}

.mots-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.mots-editor h4 {
    font-size: 0.95rem;
    margin: 0;
    color: var(--text);
}

.mots-toolbar {
    display: flex;
    gap: 10px;
}

.btn-grouper {
    padding: 8px 16px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-small);
    color: var(--text);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

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

.editor-hint {
    font-size: 0.8rem;
    color: var(--text-light);
    margin-bottom: 15px;
    font-style: italic;
}

.editor-placeholder {
    color: var(--text-light);
    font-style: italic;
}

.mots-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mot-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mot-etiquette {
    padding: 8px 12px;
    background: var(--white);
    border: 2px solid #ddd;
    border-radius: var(--radius-small);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 1rem;
}

.mot-etiquette:hover {
    border-color: var(--primary);
}

.mot-etiquette.selected {
    border-color: var(--primary);
    background: var(--primary);
}

.mot-etiquette.non-defini {
    border-style: dashed;
    border-color: #ff9800;
    background: #fff8e1;
}

/* Mot sélectionné pour groupement */
.mot-item.selected .mot-etiquette,
.mot-etiquette.selected {
    border-color: #1976D2 !important;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.3);
}

/* Amélioration tactile mobile */
.mot-etiquette {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}

.mot-etiquette:active {
    transform: scale(0.95);
}

/* Groupe de mots */
.mot-item.groupe {
    position: relative;
}

.mot-item.groupe .mot-etiquette {
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-color: #ffb74d;
    padding: 8px 16px;
}

.btn-degrouper {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    padding: 0;
    background: #ef5350;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.mot-item.groupe:hover .btn-degrouper {
    opacity: 1;
}

.mot-classe {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
}

/* Classes grammaticales couleurs */
.mot-etiquette[data-type="determinant"] { background: #efebe9; border-color: #a1887f; }
.mot-etiquette[data-type="pronom"] { background: #e3f2fd; border-color: #64b5f6; }
.mot-etiquette[data-type="nomCommun"] { background: #e3f2fd; border-color: #1e88e5; }
.mot-etiquette[data-type="nomPropre"] { background: #bbdefb; border-color: #42a5f5; }
.mot-etiquette[data-type="verbe"] { background: #ffebee; border-color: #ef5350; }
.mot-etiquette[data-type="adjectif"] { background: #e8f5e9; border-color: #81c784; }
.mot-etiquette[data-type="adverbe"] { background: #f3e5f5; border-color: #ba68c8; }
.mot-etiquette[data-type="preposition"] { background: #f5f5f5; border-color: #bdbdbd; }
.mot-etiquette[data-type="conjonction"] { background: #fff8e1; border-color: #ffca28; }
.mot-etiquette[data-type="groupeNominal"] { background: #fff3e0; border-color: #ffb74d; }
.mot-etiquette[data-type="ponctuation"] { background: #fafafa; border-color: #e0e0e0; }

/* Menu sélection classe */
.classe-menu {
    position: absolute;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 10px;
    z-index: 100;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 5px;
    min-width: 250px;
}

.classe-option {
    padding: 8px 12px;
    border: none;
    background: var(--background);
    border-radius: var(--radius-small);
    cursor: pointer;
    font-size: 0.85rem;
    text-align: left;
    transition: background 0.2s;
}

.classe-option:hover {
    background: var(--primary);
}

.classe-option.selected {
    background: var(--primary);
    font-weight: 500;
}

.menu-titre {
    grid-column: 1 / -1;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    padding: 5px 10px;
    border-bottom: 1px solid #eee;
    margin-bottom: 5px;
}

/* ============================================
   Configuration transformation (étape 4)
   ============================================ */

.phrase-config-card {
    background: var(--white);
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 25px;
}

.phrase-config-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #eee;
}

.phrase-config-header h4 {
    margin: 0;
    font-size: 1rem;
}

.phrase-preview-text {
    font-style: italic;
    color: var(--text-light);
    max-width: 60%;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.config-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.config-fields.hidden {
    display: none;
}

/* Boutons small */
.btn-add-small {
    background: var(--primary);
    border: 1px solid var(--primary-dark);
    border-radius: 12px;
    color: var(--text);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 10px;
    margin-left: 8px;
}

.btn-add-small:hover {
    background: var(--primary-dark);
    color: white;
}

.btn-remove-small {
    background: transparent;
    border: none;
    color: var(--error);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 8px;
    line-height: 1;
}

.btn-remove-small:hover {
    background: var(--error-bg);
    border-radius: 4px;
}

/* Liste des réponses */
.reponses-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reponse-item {
    display: flex;
    gap: 8px;
    align-items: center;
}

.reponse-input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    font-size: 0.95rem;
}

/* Liste des cibles (remplacement) */
.cibles-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.cible-item {
    padding: 15px;
    background: var(--background);
    border-radius: var(--radius-small);
}

.cible-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.cible-mot {
    font-weight: 500;
}

/* Multi-cibles remplacement */
.cibles-remplacement-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.cible-remplacement-item {
    padding: 12px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: var(--radius-small);
}

.cible-remplacement-item .cible-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.cible-remplacement-item .cible-select-remplacement {
    flex: 1;
}

.cible-remplacement-item .options-remplacement-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    font-size: 0.9rem;
}

.cible-remplacement-item .options-remplacement-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Insertions ajout (multi-positions) */
.insertions-ajout-list,
.insertions-serie-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}

.insertion-ajout-item,
.insertion-item {
    padding: 12px;
    background: #e8f5e9;
    border: 1px solid #c8e6c9;
    border-radius: var(--radius-small);
}

.insertion-ajout-item .insertion-row,
.insertion-item .insertion-row {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}

.insertion-ajout-item .insertion-select-ajout,
.insertion-item .config-select {
    flex: 1;
}

.insertion-ajout-item .options-insertion-input,
.insertion-item .config-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    font-size: 0.9rem;
}

.insertion-ajout-item .options-insertion-input:focus,
.insertion-item .config-input:focus {
    border-color: var(--primary);
    outline: none;
}

/* Section série */
.serie-section {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.serie-section h4 {
    margin-bottom: 15px;
}

.phrases-serie-list {
    margin-bottom: 15px;
}

/* Carte phrase série */
.phrase-serie-card {
    background: var(--white);
    border: 1px solid #eee;
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 15px;
}

.phrase-serie-card .phrase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.phrase-serie-card .phrase-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.phrase-serie-card .phrase-input-row textarea {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--radius-small);
    font-size: 0.95rem;
    resize: vertical;
}

.phrase-serie-card .btn-small {
    padding: 8px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Éditeur de mots pour phrases série */
.phrase-mots-editor {
    margin-bottom: 15px;
    padding: 15px;
    background: var(--background);
    border-radius: var(--radius-small);
}

.mots-list-serie {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mots-list-serie .mot-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.mots-list-serie .mot-etiquette {
    padding: 8px 14px;
    background: var(--white);
    border: 2px solid #ddd;
    border-radius: var(--radius-small);
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s;
}

.mots-list-serie .mot-etiquette:hover {
    border-color: var(--primary);
    background: var(--primary);
}

.mots-list-serie .mot-etiquette.non-defini {
    border-style: dashed;
    border-color: #F44336;
}

.mots-list-serie .mot-classe {
    font-size: 0.7rem;
    color: var(--text-light);
    text-transform: uppercase;
}

.mots-list-serie .mot-etiquette.selected {
    border-color: var(--primary-dark);
    background: var(--primary);
}

.mots-list-serie .mot-item.groupe {
    position: relative;
}

.mots-list-serie .mot-item.groupe .mot-etiquette {
    border-color: #1976D2;
    background: #E3F2FD;
}

.mots-list-serie .btn-degrouper {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #F44336;
    color: white;
    border: none;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mots-toolbar-serie {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 10px;
}

.mots-toolbar-serie .btn-grouper {
    padding: 6px 12px;
    background: var(--primary);
    border: none;
    border-radius: var(--radius-small);
    font-size: 0.85rem;
    cursor: pointer;
}

.mots-toolbar-serie .btn-grouper:hover {
    background: var(--primary-dark);
}

.hint-serie {
    margin: 10px 0 0 0;
    font-size: 0.75rem;
    color: var(--text-light);
    font-style: italic;
}

.mot-tag {
    display: inline-block;
    padding: 4px 10px;
    background: var(--white);
    border: 1px solid #ddd;
    border-radius: 15px;
    font-size: 0.85rem;
}

/* Configuration spécifique par phrase */
.phrase-config-section {
    background: #FFF8E1;
    padding: 15px;
    border-radius: var(--radius-small);
    margin-top: 15px;
    border: 1px solid #FFE082;
}

.config-row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

.config-row:last-child {
    margin-bottom: 0;
}

.config-row label {
    font-size: 0.85rem;
    font-weight: 500;
    color: #F57F17;
}

.config-select {
    padding: 8px 12px;
    border: 1px solid #FFE082;
    border-radius: var(--radius-small);
    background: white;
    font-size: 0.9rem;
}

.config-input {
    padding: 8px 12px;
    border: 1px solid #FFE082;
    border-radius: var(--radius-small);
    font-size: 0.9rem;
}

.config-select:focus,
.config-input:focus {
    outline: none;
    border-color: #FFB74D;
}

/* Multi-cibles dans les phrases de série */
.cibles-serie-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
}

.cible-serie-item {
    padding: 10px;
    background: white;
    border: 1px solid #FFE082;
    border-radius: var(--radius-small);
}

.cible-serie-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 6px;
}

.cible-serie-row select {
    flex: 1;
}

.cible-serie-item .config-input {
    width: 100%;
}

.phrase-reponses {
    border-top: 1px solid #eee;
    padding-top: 15px;
}

.phrase-reponses > label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
    font-size: 0.9rem;
}

/* ============================================
   Section test (étape 5)
   ============================================ */

.test-section {
    text-align: center;
    padding: 30px;
    background: var(--background);
    border-radius: var(--radius);
    margin-bottom: 25px;
}

.btn-tester {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 15px 30px;
    background: #4CAF50;
    color: white;
    border: none;
    border-radius: var(--radius);
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-tester:hover {
    background: #43A047;
}

.test-hint {
    margin-top: 10px;
    color: var(--text-light);
    font-size: 0.9rem;
}

/* ============================================
   Info-bulles d'aide contextuelle
   ============================================ */

.info-bubble {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    margin-left: 6px;
    background: var(--text-light);
    color: white;
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 600;
    cursor: help;
    position: relative;
    vertical-align: middle;
    transition: background 0.2s;
}

.info-bubble:hover {
    background: var(--primary-dark);
}

.info-bubble .tooltip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #333;
    color: white;
    padding: 10px 14px;
    border-radius: var(--radius-small);
    font-size: 0.8rem;
    font-weight: normal;
    line-height: 1.4;
    white-space: normal;
    width: 250px;
    max-width: 90vw;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.info-bubble .tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #333;
}

.info-bubble:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Label avec info-bulle */
.label-with-help {
    display: inline-flex;
    align-items: center;
}

/* Responsive nouveaux éléments */
@media (max-width: 768px) {
    .phrase-input-row {
        flex-direction: column;
    }

    .phrase-input-row .btn-secondary {
        width: 100%;
    }

    .classe-menu {
        grid-template-columns: 1fr;
        left: 10px !important;
        right: 10px !important;
        width: auto !important;
    }

    .phrase-config-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .phrase-preview-text {
        max-width: 100%;
    }

    .info-bubble .tooltip {
        left: auto;
        right: 0;
        transform: none;
    }

    .info-bubble .tooltip::after {
        left: auto;
        right: 15px;
        transform: none;
    }
}

/* ============================================
   Section IA - Génération assistée
   ============================================ */

.ia-section {
    background: linear-gradient(135deg, #f3e5f5 0%, #e1bee7 100%);
    border-radius: var(--radius);
    padding: 20px;
    margin-top: 30px;
    border: 2px dashed #9c27b0;
}

.ia-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.ia-header h3 {
    margin: 0;
    color: #6a1b9a;
    font-size: 1.1rem;
}

.ia-badge {
    background: #9c27b0;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 600;
}

.ia-usage-badge {
    display: none;
    margin-left: auto;
    background: #e1f5fe;
    color: #0277bd;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.ia-usage-badge.visible {
    display: flex;
    align-items: center;
    gap: 5px;
}

.ia-usage-badge #ia-usage-count {
    background: #0277bd;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.ia-stats-admin {
    display: none;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border: 1px solid #ffb74d;
    border-radius: 10px;
    padding: 12px 15px;
    margin-bottom: 15px;
    gap: 20px;
}

.ia-stats-admin.visible {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}

.ia-stats-admin .stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.9rem;
    color: #e65100;
}

.ia-stats-admin .stat-item strong {
    background: #ff9800;
    color: white;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 0.95rem;
}

.ia-description {
    color: #666;
    margin-bottom: 15px;
    font-size: 0.95rem;
}

.ia-options {
    display: flex;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.ia-option {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ia-option label {
    font-weight: 500;
    color: #6a1b9a;
    font-size: 0.9rem;
}

.ia-option select,
.ia-option input {
    padding: 8px 12px;
    border: 1px solid #ce93d8;
    border-radius: 6px;
    font-size: 0.95rem;
    background: white;
}

.ia-option input {
    min-width: 200px;
}

.btn-ia {
    background: linear-gradient(135deg, #9c27b0 0%, #7b1fa2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-ia:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(156, 39, 176, 0.4);
}

.btn-ia:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ia-loading {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px;
    color: #6a1b9a;
}

.ia-loading .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid #e1bee7;
    border-top-color: #9c27b0;
    border-radius: 50%;
    animation: ia-spin 1s linear infinite;
}

@keyframes ia-spin {
    to { transform: rotate(360deg); }
}

.ia-error {
    background: #ffebee;
    color: #c62828;
    padding: 12px 15px;
    border-radius: 6px;
    margin-top: 15px;
    font-size: 0.95rem;
}

.ia-results {
    margin-top: 20px;
}

.ia-results h4 {
    color: #6a1b9a;
    margin-bottom: 15px;
}

.ia-phrase-card {
    background: white;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 10px;
    border: 1px solid #e1bee7;
    transition: all 0.3s;
}

.ia-phrase-card.accepted {
    border-color: #4caf50;
    background: #e8f5e9;
}

.ia-phrase-card.refused {
    opacity: 0.5;
    transform: scale(0.98);
}

.ia-phrase-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.ia-phrase-num {
    font-weight: 600;
    color: #6a1b9a;
}

.ia-phrase-actions {
    display: flex;
    gap: 8px;
}

.ia-phrase-actions .btn-small {
    padding: 5px 12px;
    font-size: 0.85rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 500;
}

.ia-phrase-actions .btn-accept {
    background: #4caf50;
    color: white;
}

.ia-phrase-actions .btn-accept:hover {
    background: #43a047;
}

.ia-phrase-actions .btn-refuse {
    background: #f44336;
    color: white;
}

.ia-phrase-actions .btn-refuse:hover {
    background: #e53935;
}

.accepted-label {
    color: #4caf50;
    font-weight: 600;
}

.refused-label {
    color: #f44336;
    font-weight: 600;
}

.ia-phrase-text {
    font-size: 1.05rem;
    margin-bottom: 8px;
    color: #333;
}

.ia-phrase-reponses {
    color: #666;
    font-size: 0.9rem;
}

.ia-phrase-reponses strong {
    color: #6a1b9a;
}

/* Zone feedback pour affiner la génération */
.ia-feedback {
    margin-top: 20px;
    padding: 15px;
    background: linear-gradient(135deg, #fff3e0 0%, #ffe0b2 100%);
    border-radius: 10px;
    border: 1px solid #ffb74d;
}

.ia-feedback label {
    display: block;
    font-weight: 600;
    color: #e65100;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.ia-feedback textarea {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid #ffb74d;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    resize: vertical;
    background: white;
    margin-bottom: 10px;
}

.ia-feedback textarea:focus {
    outline: none;
    border-color: #e65100;
    box-shadow: 0 0 0 3px rgba(230, 81, 0, 0.1);
}

.ia-feedback textarea::placeholder {
    color: #999;
}

.btn-regenerate {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-regenerate:hover {
    background: linear-gradient(135deg, #f57c00 0%, #e65100 100%);
    transform: translateY(-1px);
}

.btn-regenerate:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.ia-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e1bee7;
}

/* Responsive IA section */
@media (max-width: 768px) {
    .ia-options {
        flex-direction: column;
        gap: 15px;
    }

    .ia-option input {
        min-width: 100%;
    }

    .ia-phrase-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .ia-actions {
        flex-direction: column;
    }

    .ia-actions button {
        width: 100%;
    }
}

/* Toast notification */
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(20px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(-50%) translateY(0); }
    to { opacity: 0; transform: translateX(-50%) translateY(20px); }
}

/* ============================================
   Popup Guide Eduscol
   ============================================ */

.popup-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 10000;
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}

.popup-overlay.active {
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.popup-content {
    background: white;
    border-radius: 16px;
    max-width: 900px;
    width: 100%;
    margin: 20px auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: popupIn 0.3s ease-out;
}

@keyframes popupIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.popup-content h2 {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 25px 30px;
    margin: 0;
    border-radius: 16px 16px 0 0;
    font-size: 1.5rem;
}

.popup-subtitle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: rgba(255, 255, 255, 0.9);
    margin: 0;
    padding: 0 30px 20px;
    font-size: 0.95rem;
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.popup-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.guide-content {
    padding: 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.guide-intro {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 25px;
    border-left: 4px solid #667eea;
}

.guide-intro p {
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.guide-intro p:last-child {
    margin-bottom: 0;
}

.guide-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #eee;
}

.guide-section:last-of-type {
    border-bottom: none;
}

.guide-section h3 {
    color: #667eea;
    font-size: 1.2rem;
    margin: 0 0 12px 0;
}

.guide-section p {
    margin: 0 0 15px 0;
    line-height: 1.6;
    color: #444;
}

.guide-section ul {
    margin: 0;
    padding-left: 20px;
}

.guide-section li {
    margin-bottom: 10px;
    line-height: 1.6;
    color: #555;
}

.guide-section li em {
    color: #666;
    font-style: italic;
}

.guide-tableau {
    margin-top: 30px;
}

.guide-tableau h3 {
    color: #667eea;
    font-size: 1.2rem;
    margin: 0 0 15px 0;
}

.tableau-synthese {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.tableau-synthese th,
.tableau-synthese td {
    padding: 12px 10px;
    text-align: left;
    border: 1px solid #e0e0e0;
}

.tableau-synthese th {
    background: #667eea;
    color: white;
    font-weight: 600;
}

.tableau-synthese tbody tr:nth-child(even) {
    background: #f8f9fa;
}

.tableau-synthese tbody tr:hover {
    background: #e8eaf6;
}

.tableau-synthese td:first-child {
    white-space: nowrap;
}

.tableau-synthese td:last-child {
    text-align: center;
    white-space: nowrap;
}

.guide-download {
    margin-top: 25px;
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.btn-download {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

/* Responsive popup */
@media (max-width: 768px) {
    .popup-overlay {
        padding: 10px;
    }

    .popup-content {
        margin: 10px auto;
    }

    .popup-content h2 {
        font-size: 1.2rem;
        padding: 20px;
    }

    .popup-subtitle {
        padding: 0 20px 15px;
        font-size: 0.85rem;
    }

    .guide-content {
        padding: 20px;
    }

    .tableau-synthese {
        font-size: 0.8rem;
    }

    .tableau-synthese th,
    .tableau-synthese td {
        padding: 8px 6px;
    }

    /* Rendre le tableau scrollable horizontalement */
    .guide-tableau {
        overflow-x: auto;
    }
}

/* ============================================
   Popup Objectifs par niveau
   ============================================ */

.ressource-box-objectifs {
    margin-top: 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-left-color: #4caf50;
}

.ressource-box-objectifs .ressource-link {
    color: #2e7d32;
}

.ressource-box-objectifs .ressource-link:hover {
    color: #1b5e20;
}

.popup-objectifs {
    max-width: 1000px;
}

.popup-objectifs h2 {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
}

.objectifs-content {
    padding: 25px 30px;
    max-height: 70vh;
    overflow-y: auto;
}

.objectifs-intro {
    background: #f1f8e9;
    padding: 18px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #4caf50;
}

.objectifs-intro p {
    margin: 0 0 10px 0;
    line-height: 1.6;
}

.objectifs-intro p:last-of-type {
    margin-bottom: 0;
}

.manip-list {
    margin: 12px 0 0 0;
    padding-left: 20px;
}

.manip-list li {
    margin-bottom: 6px;
    line-height: 1.5;
}

/* Onglets Cycle 2 / Cycle 3 */
.objectifs-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.objectifs-tab {
    padding: 10px 20px;
    border: none;
    background: #e0e0e0;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s;
    color: #555;
}

.objectifs-tab:hover {
    background: #d0d0d0;
}

.objectifs-tab.active {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    color: white;
}

.objectifs-tab-content {
    display: none;
}

.objectifs-tab-content.active {
    display: block;
}

/* Tableau des objectifs */
.tableau-objectifs {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.tableau-objectifs th,
.tableau-objectifs td {
    padding: 10px 8px;
    text-align: left;
    border: 1px solid #e0e0e0;
    vertical-align: top;
}

.tableau-objectifs th {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    color: white;
    font-weight: 600;
    position: sticky;
    top: 0;
}

.tableau-objectifs tbody tr:nth-child(even) {
    background: #f5f5f5;
}

.tableau-objectifs tbody tr:hover {
    background: #e8f5e9;
}

.tableau-objectifs em {
    color: #555;
    font-size: 0.92em;
}

/* Badges de niveau */
.niveau-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    color: white;
}

.niveau-badge.cp {
    background: #9c27b0;
}

.niveau-badge.ce1 {
    background: #3f51b5;
}

.niveau-badge.ce2 {
    background: #2196f3;
}

.niveau-badge.cm1 {
    background: #009688;
}

.niveau-badge.cm2 {
    background: #ff9800;
}

.niveau-badge.sixieme {
    background: #f44336;
}

.objectifs-download {
    margin-top: 20px;
    text-align: center;
    padding-top: 15px;
    border-top: 1px solid #e0e0e0;
}

/* Responsive objectifs */
@media (max-width: 768px) {
    .popup-objectifs {
        margin: 10px;
    }

    .objectifs-content {
        padding: 15px;
    }

    .objectifs-tabs {
        flex-direction: column;
        gap: 5px;
    }

    .objectifs-tab {
        border-radius: 8px;
    }

    .tableau-objectifs {
        font-size: 0.75rem;
    }

    .tableau-objectifs th,
    .tableau-objectifs td {
        padding: 6px 4px;
    }

    .objectifs-tab-content {
        overflow-x: auto;
    }

    .niveau-badge {
        padding: 3px 6px;
        font-size: 0.75rem;
    }
}
