/* Variables de couleur et polices */
:root {
    --primary-color: #2563eb;
    --secondary-color: #1e40af;
    --background-color: #f8fafc;
    --text-color: #1e293b;
    --error-color: #dc2626;
    --success-color: #16a34a;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --font-family: 'Inter', sans-serif;
}

/* Réinitialisation et styles de base */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Conteneur principal */
.app-container {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    width: 100%;
}

/* En-tête */
.app-header {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
    padding: 30px;
    border-radius: 0 0 20px 20px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.logo {
    height: 50px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

h1 {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* Boutons */
.btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 50px;
    font-weight: 600;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    border: none;
    outline: none;
}

.btn-primary {
    background-color: white;
    color: var(--primary-color);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-secondary {
    background-color: transparent;
    border: 2px solid white;
    color: white;
}

.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Contenu principal */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

/* Spinner de chargement */
.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    animation: rotate 2s linear infinite;
}

.spinner .path {
    stroke: var(--primary-color);
    stroke-linecap: round;
    stroke-width: 5;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}

.loading-spinner p {
    font-size: 18px;
    color: var(--text-color);
    font-weight: 500;
}

/* Contenu de la lettre */
.letter-container {
    background: white;
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 800px;
    margin-top: 20px;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.5s ease forwards;
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.letter-content {
    /*font-size: 16px;*/
    line-height: 1.8;
}

.letter-content h2 {
    font-size: 22px;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.letter-content p {
    margin-bottom: 15px;
}

/* Message d'erreur */
.error-message {
    text-align: center;
    color: var(--error-color);
    padding: 20px;
    background: rgba(220, 38, 38, 0.1);
    border-radius: 12px;
    margin-top: 20px;
}

.btn-retry {
    margin-top: 10px;
    background-color: var(--error-color);
    color: white;
}

.btn-retry:hover {
    background-color: #b91c1c;
}

/* Pied de page */
.app-footer {
    text-align: center;
    padding: 20px;
    font-size: 14px;
    color: #64748b;
    margin-top: 40px;
}

/* Responsive */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
    }

    .letter-container {
        padding: 20px;
    }

    .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Styles pour les notifications toast */
.toast {
    visibility: hidden;
    min-width: 250px;
    background-color: #333;
    color: #fff;
    text-align: center;
    border-radius: 4px;
    padding: 16px;
    position: fixed;
    z-index: 1000;
    right: 20px;
    top: 20px;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.5s, visibility 0.5s;
}

.toast.show {
    visibility: visible;
    opacity: 1;
}

#editor {
    display: block; /* Doit être visible */
    height: 500px; /* Hauteur suffisante pour l'éditeur */
}

.btn-edit {
    background-color: #4CAF50; /* Couleur verte */
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-edit:hover {
    background-color: #45a049; /* Couleur verte plus foncée au survol */
}

.btn-edit i {
    margin-right: 8px; /* Espace entre l'icône et le texte */
}

/* Styles pour la boîte de dialogue */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 20px;
    border-radius: 8px;
    width: 80%;
    max-width: 800px;
    position: relative;
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
}

textarea {
    width: 100%;
    padding: 10px;
    border-radius: 5px;
    border: 1px solid #ccc;
    font-family: Arial, sans-serif;
    font-size: 14px;
    margin-bottom: 10px;
}

.btn-save {
    background-color: #4CAF50;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.btn-save:hover {
    background-color: #45a049;
}

/* Styles pour l'impression */
@media print {
    /* Masquer l'en-tête, le pied de page et les boutons */
    .app-header, .app-footer, .header-actions, .btn {
        display: none;
    }

/* Styles pour le sélecteur de langue */
.language-selector {
    position: relative;
    margin-right: 10px;
}

.language-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: #f0f0f0;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    transition: background-color 0.3s ease;
}

.language-button:hover {
    background-color: #e0e0e0;
}

.flag-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.language-options {
    position: absolute;
    top: 50px;
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 1000;
    min-width: 120px;
}

.language-options.show {
    display: block;
}

.language-option {
    display: flex;
    align-items: center;
    padding: 10px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.language-option:hover {
    background-color: #f0f0f0;
}

.language-option .flag-icon {
    margin-right: 8px;
}