/* Dictionnaire — page principale et embed */

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: linear-gradient(135deg, #f8f9ff 0%, #f0f2ff 100%);
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    overflow: hidden;
}

.multilingual-subtitle {
        text-align: center;
        margin-bottom: 20px;
    }

    .multilingual-subtitle .tifinagh {
        display: block;
        font-size: 1.3em;
        font-weight: bold;
        color: #2c3e50;
        margin-bottom: 10px;
        text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
    }

    .multilingual-subtitle .languages {
        display: flex;
        justify-content: center;
        align-items: center;
        gap: 15px;
        font-size: 0.9em;
        color: #666;
    }

    .multilingual-subtitle .french {
        color: #2980b9;
        font-weight: 500;
    }

    .multilingual-subtitle .arabic {
        color: #8e44ad;
        font-weight: 500;
        direction: rtl;
    }

    .multilingual-subtitle .separator {
        color: #7f8c8d;
        font-weight: 300;
    }
    
    .search-info {
        background: #e3f2fd;
        border: 1px solid #2196f3;
        border-radius: 8px;
        padding: 10px;
        margin-bottom: 20px;
        font-size: 0.9em;
        color: #1976d2;
    }
    
    .search-status {
        background: #fff3cd;
        border: 1px solid #ffc107;
        border-radius: 8px;
        padding: 10px;
        margin: 15px 0;
        font-size: 0.9em;
        color: #856404;
        text-align: center;
    }
    
    .search-status.valid {
        background: #d4edda;
        border-color: #28a745;
        color: #155724;
    }
    
    .search-status.invalid {
        background: #f8d7da;
        border-color: #dc3545;
        color: #721c24;
    }
    
    .results-count {
        background: #e8f5e8;
        border: 1px solid #28a745;
        border-radius: 8px;
        padding: 10px;
        margin: 15px 0;
        font-size: 0.9em;
        color: #155724;
        text-align: center;
        font-weight: 600;
    }
    
    .search-section {
        padding: 40px;
        background: linear-gradient(135deg, #fafbff 0%, #f5f7ff 100%);
        border-bottom: 1px solid rgba(102, 126, 234, 0.15);
    }
    
    /* Styles spécifiques au dictionnaire (les styles de recherche sont maintenant dans base_TifKeyBoard_search.html) */
    
    .results-section {
        padding: 40px;
    }
    
    .no-results {
        text-align: center;
        padding: 60px;
        color: #6c757d;
        font-size: 1.2em;
    }
    
    .error-message {
        text-align: center;
        padding: 40px;
        background: #fff5f5;
        border: 2px solid #feb2b2;
        border-radius: 10px;
        color: #c53030;
        font-size: 1.2em;
        font-weight: 600;
        margin: 20px 0;
        box-shadow: 0 4px 12px rgba(245, 101, 101, 0.15);
    }
    
    .error-message::before {
        content: "⚠️ ";
        font-size: 1.5em;
        margin-right: 10px;
    }
    
    .entry-card {
        background: linear-gradient(135deg, #ffffff 0%, #fafbff 100%);
        border-radius: 10px;
        padding: 25px;
        margin-bottom: 20px;
        box-shadow: 0 5px 15px rgba(0,0,0,0.08);
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        border: 1px solid rgba(102, 126, 234, 0.1);
    }
    
    .entry-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 25px rgba(0,0,0,0.12);
    }

    .entry-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        padding-bottom: 15px;
        border-bottom: 2px solid #e9ecef;
        gap: 15px;
        flex-wrap: wrap;
    }

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

    
    .word-info {
        display: flex;
        align-items: center;
        gap: 15px;
    }
    
    .main-word {
        font-size: 2.5em;
        font-weight: 600;
        color: #2c3e50;
        line-height: 1.2;
    }

    .main-word-container {
        display: flex;
        align-items: center;
        gap: 15px;
    }

    .grammar-info {
        background: #e3f2fd;
        color: #1976d2;
        padding: 8px 15px;
        border-radius: 20px;
        font-size: 0.9em;
        font-weight: 600;
    }
    
    .definitions {
        margin-top: 20px;
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 20px;
    }

    /* Responsive pour les définitions en grille - doit venir APRÈS la règle de base */
    @media (max-width: 1200px) {
        .definitions {
            grid-template-columns: repeat(2, 1fr);
        }
    }

    @media (max-width: 768px) {
        .definitions {
            grid-template-columns: 1fr;
        }
    }
    
    .definition-item {
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        padding: 20px;
        margin-bottom: 0;
        display: flex;
        flex-direction: column;
    }
    
    .definition-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 10px;
        padding-bottom: 8px;
        border-bottom: 1px solid #e9ecef;
    }
    
    .definition-type {
        padding: 3px 8px;
        border-radius: 12px;
        font-size: 0.7em;
        font-weight: 600;
    }
    
    .definition-badge {
        background: #4caf50;
        color: white;
    }
    
    .exemple-badge {
        background: #ff9800;
        color: white;
    }
    
    .definition-type-main {
        border-left: 4px solid #4caf50;
        background: #f8fff8;
    }
    
    .exemple-type {
        border-left: 4px solid #ff9800;
        background: #fff8f0;
        opacity: 0.9;
    }
    
    .definition-content {
        display: flex;
        flex-direction: column;
    }
    
    .definition-text {
        line-height: 1.6;
        color: #2c3e50;
    }
    
    .definition-label {
        font-size: 0.75em;
        color: #999;
        font-weight: 400;
        opacity: 0.7;
    }
    
    .definition-languages-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 15px;
        margin: 10px 0;
        width: 100%;
    }
    
    .definition-french {
        flex: 1;
    }
    
    .definition-arabic {
        flex: 1;
        text-align: right;
        direction: rtl;
    }
    
    .definition-illustration-wrapper {
        margin-top: 15px;
        text-align: center;
        width: 100%;
        display: block;
    }
    
    .definition-examples {
        background: #fff3cd;
        border: 1px solid #ffeaa7;
        border-radius: 6px;
        padding: 15px;
    }
    
    .examples-title {
        font-weight: 600;
        color: #856404;
        margin-bottom: 10px;
    }
    
    .example-item {
        margin-bottom: 8px;
        padding: 8px;
        background: white;
        border-radius: 4px;
        border-left: 3px solid #ffc107;
    }
    
    .loading {
        text-align: center;
        padding: 60px;
        color: #6c757d;
        font-size: 1.2em;
    }
    
    .loading::after {
        content: '';
        display: inline-block;
        width: 20px;
        height: 20px;
        border: 3px solid #f3f3f3;
        border-top: 3px solid #667eea;
        border-radius: 50%;
        animation: spin 1s linear infinite;
        margin-left: 10px;
    }
    
    @keyframes spin {
        0% { transform: rotate(0deg); }
        100% { transform: rotate(360deg); }
    }
    
    .images-section {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #e9ecef;
    }
    
    .image-container {
        position: relative;
        display: inline-block;
        margin: 10px;
    }
    
    .dictionary-image {
        max-width: 200px;
        border-radius: 8px;
        transition: transform 0.2s ease;
        cursor: pointer;
        display: block;
    }
    
    .image-container.ircam .dictionary-image {
        border: 3px solid #3498db;
        box-shadow: 0 3px 10px rgba(52, 152, 219, 0.3);
    }
    
    .image-container.sante .dictionary-image {
        border: 3px solid #27ae60;
        box-shadow: 0 3px 10px rgba(39, 174, 96, 0.3);
    }
    
    .image-container.animal .dictionary-image {
        border: 3px solid #d2b48c;
        box-shadow: 0 3px 10px rgba(210, 180, 140, 0.3);
    }
    
    .image-container:hover .dictionary-image {
        transform: scale(1.05);
    }
    
    .image-source-badge {
        position: absolute;
        top: -8px;
        right: 8px;
        display: inline-flex;
        align-items: center;
        gap: 2px;
        padding: 2px 6px;
        border-radius: 8px;
        font-size: 0.6em;
        font-weight: 600;
        color: white;
        box-shadow: 0 2px 5px rgba(0,0,0,0.25);
        z-index: 10;
    }
    
    .image-source-badge.ircam {
        background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    }
    
    .image-source-badge.sante {
        background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    }
    
    .image-source-badge.animal {
        background: linear-gradient(135deg, #d2b48c 0%, #bc9a6f 100%);
    }
    
    /* Styles pour les images d'illustration */
    .illustration-images-wrapper {
        margin-top: 15px;
        padding-top: 15px;
        border-top: 1px solid #e9ecef;
    }
    
    .illustration-image-container {
        position: relative;
        display: inline-block;
        margin: 5px;
    }
    
    .definition-illustration-image {
        max-width: 200px;
        max-height: 200px;
        border-radius: 8px;
        cursor: pointer;
        border: 2px solid #e0e0e0;
        transition: transform 0.2s ease, box-shadow 0.2s ease;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .definition-illustration-image:hover {
        transform: scale(1.05);
        box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        border-color: #667eea;
    }
    
    
    .image-source-badge-icon {
        font-size: 0.9em;
        line-height: 1;
    }
    
    .conjugation-link-section {
        margin-left: auto;
    }
    
    .conjugation-link {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
        color: white;
        padding: 8px 16px;
        border-radius: 15px;
        text-decoration: none;
        font-weight: 600;
        font-size: 0.85em;
        transition: all 0.3s ease;
        box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
        min-width: 120px;
    }

    .conjugation-link .tifinagh {
        font-size: 16px;
        font-weight: 600;
        line-height: 1;
    }

    .conjugation-link .french {
        font-size: 10px;
        font-weight: 400;
        opacity: 0.9;
        line-height: 1;
    }
    
    .conjugation-link:hover {
        transform: translateY(-1px);
        box-shadow: 0 3px 12px rgba(40, 167, 69, 0.4);
        color: white;
        text-decoration: none;
    }
    
    .conjugation-subtitle {
        font-size: 0.75em !important;
        font-weight: 400 !important;
        color: #666 !important;
        margin-top: 2px;
        opacity: 0.8;
    }
    
    .conjugation-details {
        font-size: 0.85em !important;
        font-weight: 500 !important;
        color: #555 !important;
        line-height: 1.3;
        margin-top: 3px;
    }
    
    /* Pastilles de sources */
    .source-badges {
        display: inline-flex;
        gap: 4px;
        margin-left: 8px;
        flex-wrap: wrap;
        align-items: center;
    }
    
    .source-badge {
        display: inline-flex;
        align-items: center;
        gap: 2px;
        padding: 2px 6px;
        border-radius: 8px;
        font-size: 0.65em;
        font-weight: 500;
        color: white;
        box-shadow: 0 1px 2px rgba(0,0,0,0.15);
        transition: all 0.2s ease;
    }
    
    .source-badge:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    }
    
    .source-badge.ircam {
        background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    }
    
    .source-badge.tajrumt {
        background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    }
    
    .source-badge.sante {
        background: linear-gradient(135deg, #27ae60 0%, #229954 100%);
    }
    
    .source-badge.animal {
        background: linear-gradient(135deg, #d2b48c 0%, #bc9a6f 100%);
    }
    
    .source-badge.jardin {
        background: linear-gradient(135deg, #90ee90 0%, #7ed97e 100%);
    }
    
    .source-badge-icon {
        font-size: 0.95em;
        line-height: 1;
    }
    
    /* Modal pour les images */
    .modal {
        display: none;
        position: fixed;
        z-index: 1000;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.9);
    }
    
    .modal-content {
        margin: auto;
        display: block;
        max-width: 90%;
        max-height: 90%;
        margin-top: 5%;
    }
    
    .close {
        position: absolute;
        top: 15px;
        right: 35px;
        color: #f1f1f1;
        font-size: 40px;
        font-weight: bold;
        cursor: pointer;
    }

    /* Styles pour la voix */
    .voice-controls {
        position: relative;
        display: flex;
        align-items: center;
    }

.display-title {
    font-size: 1.1em;
    color: #666;
    margin-bottom: 5px;
    font-style: italic;
}

.voice-button {
    background-color: #667eea;
    border: none;
    border-radius: 50%;
    padding: 8px;
    cursor: pointer;
    font-size: 1.2em;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: white;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.voice-button:hover {
    background-color: #5a6fd8;
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.voice-menu {
    position: absolute;
    top: 0;
    left: 100%;
    background-color: white;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 9999;
    display: none;
    min-width: 180px;
    max-height: 200px;
    overflow-y: auto;
    margin-left: 5px;
}

.voice-option {
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.9em;
}

.voice-option:last-child {
    border-bottom: none;
}

.voice-option:hover {
    background-color: #f8f9fa;
    color: #667eea;
}

.voice-option.active {
    background-color: #e3f2fd;
    color: #1976d2;
    font-weight: 600;
}

/* Règles responsive pour mobile */
@media (max-width: 768px) {
    .multilingual-subtitle .tifinagh {
        font-size: 1.1em;
        margin-bottom: 8px;
    }
    .multilingual-subtitle .languages {
        gap: 10px;
        font-size: 0.8em;
    }
    .search-section {
        padding: 25px;
    }
    .search-box {
        gap: 10px;
        margin-bottom: 20px;
    }
    .search-input {
        padding: 12px 15px;
        font-size: 1em;
    }
    .search-button {
        padding: 12px 20px;
        font-size: 1em;
        min-width: 120px;
    }
    .search-button .tifinagh {
        font-size: 16px;
    }
    .search-button .french {
        font-size: 11px;
    }
    .keyboard-toggle-btn {
        padding: 10px 14px;
        font-size: 1.1em;
        height: 48px;
        min-width: 55px;
    }
    .stats-section {
        padding: 25px;
    }
    .stats-grid {
        gap: 15px;
    }
    .results-section {
        padding: 25px;
    }
    .entry-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .header-controls {
        width: 100%;
        justify-content: space-between;
        gap: 10px;
    }
    .word-info {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }
    .main-word-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        width: 100%;
    }
    .main-word {
        font-size: 1.8em;
    }
    .conjugation-link {
        min-width: auto;
        padding: 6px 12px;
    }
    .toggle-content-btn {
        min-width: auto;
        padding: 8px 12px;
    }
    .voice-controls {
        align-self: flex-start;
    }
    .grammar-info {
        font-size: 0.8em;
        padding: 6px 10px;
    }
    .voice-menu {
        left: auto;
        right: 100%;
        margin-left: 0;
        margin-right: 5px;
    }
    .voice-controls {
        position: relative;
    }
}

@media (max-width: 480px) {
    .header-stats-wrapper {
        flex-direction: column;
        padding: 10px;
    }
    .header {
        flex: 1 1 100%;
        text-align: center;
        padding: 15px;
    }
    .header h1 {
        font-size: 1.4em;
        margin-bottom: 10px;
        text-align: center;
    }
    .stats-section {
        flex: 1 1 100%;
        padding: 15px;
    }
    .multilingual-subtitle .tifinagh {
        font-size: 1em;
        margin-bottom: 6px;
    }
    .multilingual-subtitle .languages {
        gap: 8px;
        font-size: 0.75em;
    }
    .search-section {
        padding: 20px;
    }
    .search-box {
        flex-direction: column;
        gap: 8px;
        margin-bottom: 15px;
    }
    .search-input-container {
        width: 100%;
    }
    .search-input {
        padding: 10px 12px;
        font-size: 0.95em;
    }
    .search-button {
        padding: 10px 15px;
        font-size: 0.95em;
        min-width: 100px;
        width: 100%;
    }
    .search-button .tifinagh {
        font-size: 15px;
    }
    .search-button .french {
        font-size: 10px;
    }
    .keyboard-toggle-btn {
        padding: 8px 12px;
        font-size: 1em;
        height: 44px;
        min-width: 50px;
    }
    .stats-section {
        padding: 20px;
    }
    .stats-grid {
        gap: 12px;
    }
    .results-section {
        padding: 20px;
    }
    .entry-header {
        padding-bottom: 10px;
    }
    .main-word {
        font-size: 1.5em;
    }
    .header-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .conjugation-link {
        width: 100%;
        justify-content: center;
    }
}

/* --- Page embed (dictionnaire_embed.html) --- */
.dico-embed {
    max-width: 100%;
}
.dico-meta {
    color: #666;
    font-size: 12px;
    margin-bottom: 10px;
}
.dico-entry {
    border-bottom: 1px solid #eee;
    padding: 10px 0;
}
.dico-entry:last-child {
    border-bottom: none;
}
.dico-word {
    font-weight: 600;
    font-size: 1.2em;
}
.dico-grammar {
    color: #1976d2;
    font-size: 0.85em;
    margin-top: 2px;
}
.dico-def {
    margin-top: 6px;
    padding-left: 8px;
    border-left: 3px solid #e0e0e0;
}
.dico-def-fr {
}
.dico-def-ar {
    direction: rtl;
    text-align: right;
}
.dico-none {
    color: #888;
    font-style: italic;
}
.dico-err {
    color: #c00;
}
.dico-verb-badge {
    display: inline-block;
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.8em;
    margin-left: 6px;
}
