/**
 * Styles pour la Banque de mots
 * Vocabulaire - Module /mots/
 */

/* Modal de base */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    position: relative;
}

.modal-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.25rem;
}

.modal-content p {
    margin: 0.5rem 0;
    color: var(--text-secondary, #666);
}

.modal-content .mot-name {
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-color, #333);
    padding: 0.5rem;
    background: var(--bg-secondary, #f5f5f5);
    border-radius: 6px;
    text-align: center;
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Container */
.mots-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem;
}

/* Actions */
.mots-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

/* Onglets */
.mots-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--border-color, #e0e0e0);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
}

.tab-btn:hover {
    color: var(--primary);
    background-color: var(--hover-bg, #f5f5f5);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Filtres */
.mots-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background-color: var(--card-bg, #f9f9f9);
    border-radius: 8px;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    font-size: 1rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(232, 112, 61, 0.1);
}

.filter-select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 6px;
    font-size: 1rem;
    background-color: white;
    cursor: pointer;
}

/* Barre alphabétique */
.alphabet-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--card-bg, #f9f9f9);
    border-radius: 8px;
    justify-content: center;
}

.letter-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 0.5rem;
    border: 1px solid var(--border-color, #ddd);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
}

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

.letter-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

.letter-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Toggle vue */
.view-toggle {
    display: flex;
    gap: 0.25rem;
    margin-left: auto;
}

.view-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border-color, #ddd);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    color: var(--text-secondary, #666);
    transition: all 0.2s;
}

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

.view-btn.active {
    background-color: var(--primary);
    border-color: var(--primary);
    color: white;
}

/* Grille de mots - Mode icônes */
.mots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
}

.mots-grid.view-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* Carte mot */
.mot-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.mot-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.mot-card-image {
    width: 100%;
    height: 100px;
    object-fit: cover;
    background-color: var(--card-bg, #f0f0f0);
}

.mot-card-image-placeholder {
    width: 100%;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg, #f0f0f0);
    color: var(--text-light, #999);
    font-size: 2rem;
}

.mot-card-image-placeholder svg,
.mot-card-image-placeholder i[data-lucide] {
    width: 40px;
    height: 40px;
    stroke-width: 1.5;
}

.view-list .mot-card-image-placeholder svg,
.view-list .mot-card-image-placeholder i[data-lucide] {
    width: 24px;
    height: 24px;
}

/* Mode liste */
.view-list .mot-card {
    flex-direction: row;
    align-items: center;
}

.view-list .mot-card-image,
.view-list .mot-card-image-placeholder {
    width: 50px;
    height: 50px;
    min-width: 50px;
    font-size: 1.5rem;
    border-radius: 6px 0 0 6px;
}

.view-list .mot-card-content {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 1rem;
}

.view-list .mot-card-word {
    min-width: 150px;
    margin-bottom: 0;
    font-size: 1rem;
}

.view-list .mot-card-definition {
    flex: 1;
    display: block;
    -webkit-line-clamp: 1;
}

.view-list .mot-card-meta {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.view-list .mot-card-actions {
    border-top: none;
    border-left: 1px solid var(--border-color, #eee);
    padding: 0.5rem;
}

.mot-card-content {
    padding: 1rem;
}

.mot-card-word {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-color, #333);
    margin-bottom: 0.5rem;
}

.mot-card-definition {
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mot-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, #eee);
}

.mot-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 4px;
    background-color: var(--badge-bg, #e8f5e9);
    color: var(--badge-color, #2e7d32);
}

.mot-badge svg,
.mot-badge i[data-lucide] {
    width: 12px;
    height: 12px;
    stroke-width: 2;
}

.mot-badge-theme {
    background-color: #e3f2fd;
    color: #1565c0;
}

.mot-badge-expression {
    background-color: #fff3e0;
    color: #e65100;
}

.mot-badge-sens {
    background-color: #f3e5f5;
    color: #7b1fa2;
    font-weight: 600;
}

.mot-badge-grammaire {
    background-color: #ede7f6;
    color: #5e35b1;
}

.mot-card-actions {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background-color: var(--card-bg, #f9f9f9);
    border-top: 1px solid var(--border-color, #eee);
}

.mot-card-actions .btn-icon {
    padding: 0.5rem;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.15s, color 0.15s;
    color: var(--ink-700, #45454A);
    width: 38px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.mot-card-actions .btn-icon svg,
.mot-card-actions .btn-icon i[data-lucide] {
    width: 20px;
    height: 20px;
    stroke-width: 1.75;
    color: currentColor;
}

.mot-card-actions .btn-icon:hover {
    background-color: var(--hover-bg, #e0e0e0);
}

.mot-card-actions .btn-icon.danger {
    color: var(--danger, #C8553D);
}

.mot-card-actions .btn-icon.danger:hover {
    background-color: color-mix(in oklab, var(--danger, #C8553D) 12%, white);
    color: var(--danger, #C8553D);
}

/* Stats */
.mots-stats {
    margin-top: 1.5rem;
    padding: 1rem;
    text-align: center;
    color: var(--text-secondary, #666);
    font-size: 0.9rem;
}

/* Modal large */
.modal-large {
    max-width: 720px;
    width: 92%;
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary, #666);
}

.modal-close:hover {
    color: var(--text-color, #333);
}

/* Détail mot dans modal */
.mot-detail {
    padding: 1rem;
}

.mot-detail-header {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.mot-detail-image {
    width: 240px;
    height: 240px;
    object-fit: contain;
    background-color: var(--card-bg, #f6f6f4);
    border: 1px solid var(--border-color, #eee);
    border-radius: 8px;
    flex-shrink: 0;
}

.mot-detail-image-placeholder {
    width: 240px;
    height: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--card-bg, #f0f0f0);
    border-radius: 8px;
    font-size: 3rem;
    flex-shrink: 0;
}

.mot-detail-info h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.mot-detail-info p {
    color: var(--text-secondary, #666);
    line-height: 1.6;
}

.mot-detail-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #eee);
    flex-wrap: wrap;
}

.mot-detail-actions .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.mot-detail-actions .btn svg,
.mot-detail-actions .btn i[data-lucide] {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.audio-player .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.audio-player .btn svg,
.audio-player .btn i[data-lucide] {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

/* Audio player */
.audio-player {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.audio-player button {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color, #ddd);
    background: white;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.audio-player button:hover {
    background-color: var(--hover-bg, #f5f5f5);
}

/* Détail sens - badges */
.mot-detail-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

/* Détail sens - définition */
.mot-detail-definition {
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

/* Détail sens - exemple */
.mot-detail-exemple {
    color: var(--text-secondary, #666);
    font-size: 0.95rem;
    margin-bottom: 0.5rem;
}

/* Détail sens - traduction */
.mot-detail-translation {
    color: var(--primary);
    font-size: 0.95rem;
}

/* Bloc enrichi : famille, synonymes, contraires, champ lexical */
.mot-detail-enrichi {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #eee);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mot-detail-section h4 {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary, #666);
    margin: 0 0 0.5rem 0;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.mot-detail-section h4 i[data-lucide],
.mot-detail-section h4 svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.mot-chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.mot-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.3rem 0.6rem;
    font-size: 0.9rem;
    border-radius: 999px;
    background-color: var(--badge-bg, #f1f3f5);
    color: var(--text, #333);
    border: 1px solid var(--border-color, #e6e6e6);
}

.mot-detail-morpho {
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
    color: var(--text-secondary, #666);
}

/* Autres sens */
.autres-sens {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color, #eee);
}

.autres-sens h4 {
    font-size: 0.95rem;
    color: var(--text-secondary, #666);
    margin-bottom: 0.75rem;
}

.autres-sens-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.autre-sens-card {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary, #f8f9fa);
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.autre-sens-card:hover {
    background: var(--hover-bg, #e8e8e8);
}

.autre-sens-card img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 6px;
    flex-shrink: 0;
}

.autre-sens-placeholder {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--card-bg, #e0e0e0);
    border-radius: 6px;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.autre-sens-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    overflow: hidden;
}

.autre-sens-word {
    font-weight: 600;
    font-size: 0.95rem;
}

.autre-sens-def {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Modal suppression - warning */
.delete-warning {
    margin: 1rem 0;
    padding: 1rem;
    background: #fff3e0;
    border-radius: 8px;
}

.delete-warning.hidden {
    display: none;
}

.delete-info {
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.delete-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.delete-options label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
}

.delete-options label:hover {
    background: rgba(0,0,0,0.05);
}

/* Responsive */
@media (max-width: 768px) {
    .mots-filters {
        flex-direction: column;
    }

    .filter-group {
        min-width: 100%;
    }

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

    .mot-detail-header {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    .mots-tabs {
        overflow-x: auto;
    }
}

/* Base commune - styles spécifiques */
.mot-card.validated {
    border-left: 4px solid var(--success-color, #4caf50);
}

.mot-card.pending {
    border-left: 4px solid var(--warning-color, #ff9800);
    opacity: 0.8;
}

.mot-badge-validated {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.mot-badge-pending {
    background-color: #fff3e0;
    color: #f57c00;
}

.mot-badge-rejected {
    background-color: #f5f5f5;
    color: #666;
}

/* Bouton désactivé */
.btn-disabled {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    background: #e0e0e0;
    color: #757575;
    border-radius: 8px;
    font-size: 0.9rem;
    cursor: not-allowed;
}

/* Bouton reproposer */
.btn-warning {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.btn-warning:hover {
    background: var(--primary-dark, #3d6b4a);
}

/* Empty search results */
.no-results {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary, #666);
}

.no-results-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--text-light, #999);
    display: flex;
    justify-content: center;
}

.no-results-icon svg,
.no-results-icon i[data-lucide] {
    width: 48px;
    height: 48px;
    stroke-width: 1.5;
}

/* Empty state (page vide) */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary, #666);
}

.empty-state .empty-icon {
    color: var(--text-light, #999);
    margin-bottom: 1rem;
    display: flex;
    justify-content: center;
}

.empty-state .empty-icon svg,
.empty-state .empty-icon i[data-lucide] {
    width: 56px;
    height: 56px;
    stroke-width: 1.5;
}

/* Feedback notice (retour sur proposition) */
.rejection-notice {
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-left: 4px solid var(--primary);
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
}

.rejection-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color, #333);
}

.rejection-icon {
    font-size: 1.2rem;
}

.rejection-reason {
    background: white;
    padding: 0.75rem;
    border-radius: 4px;
    margin: 0.5rem 0;
    color: #555;
    font-style: italic;
    border: 1px solid #e0e0e0;
}

.rejection-hint {
    font-size: 0.85rem;
    color: var(--primary);
    margin: 0.5rem 0 0 0;
}

/* Chargement progressif */
.load-more-container {
    grid-column: 1 / -1;
    display: flex;
    justify-content: center;
    padding: 1.5rem 0;
}

.load-more-btn {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.load-more-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* ===== Mots de formation (enseignants) =====
   Bleu repris de --ill-sky, la palette partagée lego0 — la même que la case
   à cocher de la fiche du mot. Affichage seul : aucun droit n'est modifié.
   La pastille est en aplat plein pour ne pas se confondre avec
   .mot-badge-theme, qui est déjà un bleu pâle. */

.mot-card-formation {
    background: color-mix(in oklab, var(--ill-sky) 9%, white);
    /* bordure en ombre portée : elle ne décale pas la grille */
    box-shadow: 0 0 0 2px var(--ill-sky), 0 2px 8px rgba(0, 0, 0, 0.08);
}

.mot-card-formation:hover {
    box-shadow: 0 0 0 2px var(--ill-sky), 0 4px 16px rgba(0, 0, 0, 0.12);
}

.mot-detail-formation {
    background: color-mix(in oklab, var(--ill-sky) 9%, white);
    border-radius: 12px;
    box-shadow: inset 0 0 0 2px color-mix(in oklab, var(--ill-sky) 55%, transparent);
}

.mot-badge-formation {
    background-color: var(--ill-sky);
    color: white;
    font-weight: 600;
    letter-spacing: 0.01em;
}

/* Le menu « mots de formation » n'a de sens que pour le compte qui peut en
   marquer. Masqué par défaut, révélé une fois le rôle admin confirmé.
   Le réglage est aussi neutralisé côté JS : pour les autres comptes, le
   filtre vaut toujours « tous les mots », jamais « masquer ». */
.filter-group:has(#filter-formation) { display: none; }
body.peut-formation .filter-group:has(#filter-formation) { display: block; }
