/* Imagilire Libre CSS - Version adulte avec design sobre */

@font-face {
    font-family: 'OpenDyslexic';
    src: url('../vendor/fonts/opendyslexic/OpenDyslexic-Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('../vendor/fonts/opendyslexic/OpenDyslexic-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('../vendor/fonts/opendyslexic/OpenDyslexic-Italic.woff2') format('woff2');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('../vendor/fonts/opendyslexic/OpenDyslexic-BoldItalic.woff2') format('woff2');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}

:root {
    --primary-color: #36B1B3;
    --secondary-color: #F7B731;
    --accent-color: #D4542D;
    --text-color: #333333;
    --background-color: #f5f7fa;
    --container-bg: #ffffff;
    --border-color: #e0e5ec;
    --success-color: #2ecc71;
    --error-color: #e74c3c;
    --font-family: 'Andika', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-small: 14px;
    --font-size-medium: 16px;
    --font-size-large: 18px;
    --font-size-xlarge: 20px;
    --border-radius: 6px;
    --box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
    --mobile-breakpoint: 576px;
    --tablet-breakpoint: 768px;
    --desktop-breakpoint: 992px;
    --large-desktop-breakpoint: 1200px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    font-size: var(--font-size-medium);
    color: var(--text-color);
    background-color: var(--background-color);
    line-height: 1.6;
}

body.dyslexic-font {
    font-family: 'OpenDyslexic', var(--font-family);
}

.font-size-small {
    font-size: var(--font-size-small);
}

.font-size-medium {
    font-size: var(--font-size-medium);
}

.font-size-large {
    font-size: var(--font-size-large);
}

.font-size-xlarge {
    font-size: var(--font-size-xlarge);
}

header {
    background-color: var(--primary-color);
    color: white;
    padding: 1.5rem;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Masquer l'ancien header sur mobile si le nouveau est présent */
header:not(.mobile-optimized-header) {
    display: none;
}

@media (min-width: var(--tablet-breakpoint)) {
    /* Sur tablette+, afficher l'ancien header s'il est utilisé */
    header:not(.mobile-optimized-header) {
        display: block;
    }
}

/* Masquer le bouton settings-icon (FAB) sur mobile quand le header mobile optimisé est présent */
body:has(.mobile-optimized-header) .settings-icon {
    display: none;
}

@media (min-width: var(--tablet-breakpoint)) {
    /* Sur tablette+, afficher le bouton settings-icon s'il est utilisé */
    body:has(.mobile-optimized-header) .settings-icon {
        display: flex;
    }
}

/* Fallback pour masquer le settings-icon sur mobile (pour navigateurs sans support :has()) */
@media (max-width: 767px) {
    .mobile-optimized-header ~ .settings-icon,
    .mobile-optimized-header + .settings-icon {
        display: none !important;
    }
}

@media (min-width: var(--tablet-breakpoint)) {
    .mobile-optimized-header ~ .settings-icon,
    .mobile-optimized-header + .settings-icon {
        display: flex !important;
    }
}

.header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    max-width: 1200px;
    margin: 0 auto;
}

.logo-container {
    margin-bottom: 1rem;
}

.logo {
    max-width: 100px;
    height: auto;
    border-radius: var(--border-radius);
}

@media (min-width: var(--tablet-breakpoint)) {
    .logo {
        max-width: 150px;
    }
}

.title-container {
    text-align: center;
}

header h1 {
    margin-bottom: 0.5rem;
    font-weight: 600;
}

header .subtitle {
    font-size: 1rem;
    opacity: 0.9;
}

main {
    padding: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    /* Ajustement pour le header sticky mobile */
    padding-top: 1rem;
}

/* Ajuster le padding top si header sticky mobile */
@media (max-width: 767px) {
    body:has(.mobile-optimized-header) main {
        padding-top: 1.5rem;
    }
}

@media (min-width: var(--tablet-breakpoint)) {
    main {
        padding: 2rem;
    }
    
    .header-content {
        flex-direction: row;
        justify-content: center;
        gap: 2rem;
    }
    
    .logo-container {
        margin-bottom: 0;
    }
    
    .title-container {
        text-align: left;
    }
}

.container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}

@media (min-width: var(--mobile-breakpoint)) {
    .container {
        gap: 2rem;
    }
}

@media (min-width: var(--desktop-breakpoint)) {
    .container {
        grid-template-columns: 1fr 1fr;
    }
    
    .section-ocr {
        grid-column: 1 / 2;
    }
    
    .section-text {
        grid-column: 2 / 3;
    }
    
    .section-result {
        grid-column: 1 / 3;
    }
}

.section-ocr, .section-text, .section-result {
    background-color: var(--container-bg);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--box-shadow);
}

h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.upload-container {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.upload-btn {
    background-color: var(--primary-color);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.upload-btn:hover {
    background-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.preview-container {
    margin: 1.5rem 0;
    display: flex;
    justify-content: center;
    max-height: 300px;
    overflow: hidden;
}

#imagePreview {
    max-width: 100%;
    max-height: 300px;
    object-fit: contain;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.ocr-controls {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: center;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin: 0.5rem 0;
}

.progress {
    height: 100%;
    background-color: var(--primary-color);
    width: 0%;
    transition: width 0.3s ease;
}

.status-message {
    font-size: 0.9rem;
    text-align: center;
    min-height: 1.5rem;
}

.text-controls, .result-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.text-actions {
    display: flex;
    gap: 0.5rem;
}

.text-container, .result-container {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    min-height: 200px;
    margin-bottom: 1rem;
    background-color: white;
}

#extractedText {
    width: 100%;
    height: 200px;
    border: none;
    resize: vertical;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

.result-container {
    overflow-y: auto;
    overflow-x: hidden;
    line-height: 1.8;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

.placeholder {
    color: #999;
    font-style: italic;
}

/* Styles améliorés pour les boutons */
.btn {
    padding: 0.75rem 1.2rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: all 0.3s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    min-width: 120px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: 3px solid rgba(54, 177, 179, 0.4);
    outline-offset: 2px;
}

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

.btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 3px rgba(0, 0, 0, 0.1);
}

.btn i {
    font-size: 1.1rem;
}

.btn.disabled, .btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

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

.primary-btn:hover {
    background-color: #2a9799; /* Version plus foncée de la couleur primaire */
}

.secondary-btn {
    background-color: #f8f9fa;
    color: var(--text-color);
    border: 1px solid #e0e5ec;
}

.secondary-btn:hover {
    background-color: #e9ecef;
}

.secondary-btn.active {
    background-color: var(--accent-color);
    color: white;
    border: 1px solid var(--accent-color);
}

/* Styles pour les boutons d'action spécifiques */
#processSyllabes {
    background-color: var(--secondary-color);
    color: var(--text-color);
    font-weight: 700;
    padding: 0.85rem 1.5rem;
    margin-top: 1rem;
    width: 100%;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
    display: flex;
}

#listenText {
    background-color: #4CAF50;
    color: white;
}

#listenText:hover {
    background-color: #3e8e41;
}

#listenText.active {
    background-color: #e74c3c;
}

#listenText.active:hover {
    background-color: #c0392b;
}

#listenText.active.paused {
    background-color: #f39c12;
}

#listenText.active.paused:hover {
    background-color: #d68910;
}

/* Amélioration des contrôles de résultat */
.result-controls {
    display: flex;
    justify-content: flex-start;
    gap: 0.8rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

/* Harmonisation des styles entre "Texte extrait" et "Texte syllabé" */
.section-text h2, .section-result h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 1.4rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.result-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.text-container, .result-container {
    background-color: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1rem;
    margin-bottom: 1rem;
    min-height: 200px;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

#extractedText {
    width: 100%;
    height: 100%;
    min-height: 180px;
    border: none;
    resize: none;
    font-family: inherit;
    font-size: inherit;
    outline: none;
}

/* Settings styles moved to imagilire-settings.css */

footer {
    text-align: center;
    padding: 1.5rem;
    margin-top: 2rem;
    color: #666;
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* Styles pour les syllabes */
.syllabe {
    display: inline-block;
}

.syllabe-1 {
    color: #3498db;
}

.syllabe-2 {
    color: #e74c3c;
}

.syllabe-3 {
    color: #2ecc71;
}

.syllabe-4 {
    color: #9b59b6;
}

/* Styles pour la colorisation personnalisée */
.custom-color-1 {
    color: #D4542D;
}

.custom-color-2 {
    color: #F7B731;
}

.custom-color-3 {
    color: #36B1B3;
}

.lettre-muette {
    color: #95a5a6;
    opacity: 0.7;
    font-style: italic;
}

.digramme {
    text-decoration: underline;
    text-decoration-style: dotted;
    text-decoration-thickness: 2px;
}

.mot-lu-actuel {
    background-color: rgba(255, 220, 50, 0.45);
    border-radius: 3px;
    transition: background-color 0.1s ease;
    box-shadow: 0 0 0 2px rgba(255, 220, 50, 0.3);
}

/* Animation de chargement */
@keyframes pulse {
    0% { opacity: 0.6; }
    50% { opacity: 1; }
    100% { opacity: 0.6; }
}

.loading {
    animation: pulse 1.5s infinite;
}

/* Notification styles moved to imagilire-notifications.css */

/* Media queries pour les appareils mobiles */
@media (max-width: var(--mobile-breakpoint)) {
    .btn {
        padding: 0.7rem 1rem;
        font-size: 0.9rem;
        min-width: 100px;
    }
    
    .btn i {
        font-size: 1rem;
    }
    
    .result-controls {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-top: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .section-text, .section-ocr, .section-result {
        padding: 1rem;
        margin-bottom: 1rem;
        width: 100%;
        overflow: hidden;
    }
    
    /* Correction pour le problème d'affichage de la section "Texte extrait" sur mobile */
    .section-text {
        display: flex;
        flex-direction: column;
        clear: both;
        position: relative;
        overflow: visible;
    }
    
    #extractedText {
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
        margin-bottom: 1rem;
    }
    
    #processSyllabes {
        width: 100%;
        max-width: none;
    }
    
    .text-editor {
        width: 100%;
        min-height: 150px;
    }
}

/* Media queries pour les tablettes */
@media (min-width: var(--mobile-breakpoint)) and (max-width: var(--desktop-breakpoint)) {
    .text-container, .result-container {
        min-height: 150px;
    }
    
    #extractedText {
        height: 150px;
    }
}

/* Camera interface styles moved to imagilire-camera.css */

/* Settings footer and toggle-switch styles moved to imagilire-settings.css */
