/* --- STYLES GLOBAUX & MOBILES PAR DÉFAUT --- */
body {
    font-family: 'Poppins', Arial, sans-serif;
    margin: 0;
    padding: 20px;
    background-color: #f0f4f8;
    color: #333;
}

.container {
    max-width: 1600px;
    margin: auto;
    background-color: #ffffff;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

h1 {
    text-align: center;
    color: #1e3a8a;
    font-weight: 600;
    margin: 0;
    letter-spacing: 1px;
    flex-grow: 1;
}

/* Header : empilé sur mobile */
.controls {
    display: flex;
    flex-direction: column; /* MOBILE */
    gap: 15px; /* MOBILE */
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 20px;
}

button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Poppins', sans-serif;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-bottom: 10px;
}

button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Boutons Fichier : pleine largeur sur mobile */
.file-buttons {
    width: 100%; /* MOBILE */
    text-align: center; /* MOBILE */
}

.file-buttons button {
    background-color: #4b5563;
    color: white;
    width: auto;
    margin-bottom: 0;
    display: inline-flex; /* Pour que 'width: auto' fonctionne bien */
}

/* Placeholder : caché sur mobile */
.header-placeholder {
    display: none; /* MOBILE */
}

/* Panneaux : empilés sur mobile */
.panels {
    display: flex;
    flex-direction: column; /* MOBILE */
    gap: 25px;
    align-items: stretch;
}

.panel {
    background-color: #f9fafb;
    padding: 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    position: relative; /* Contexte pour le positionnement du bouton copier */
}

/* Les flex: ... gèrent la répartition de la largeur SUR DESKTOP */
.original-text-panel { flex: 1.2; }
.key-panel-container { flex: 1; }
.result-panel { flex: 1.5; }

/* Colonnes de clés : empilées sur mobile */
.key-panel-content {
    display: flex;
    flex-direction: column; /* MOBILE */
    gap: 15px;
    height: 100%;
    flex-grow: 1;
}

.key-column {
    flex: 1;
    display: flex;
    flex-direction: column;
}

textarea {
    width: 100%;
    min-height: 300px;
    padding: 15px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
    font-family: 'Poppins', sans-serif;
    background-color: #ffffff;
    box-sizing: border-box; /* Très important ! */
    flex-grow: 1;
}

textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

#originalTextHeader { background-color: #9ca3af; color: white; cursor: default; }
#detectGenerateBtn { background-color: #0d9488; color: white; }
#anonymizeToggleBtn { background-color: #2563eb; color: white; }

#copyButton {
    position: absolute;
    top: 25px;
    right: 25px;
    width: auto;
    padding: 5px 10px;
    font-size: 12px;
    background-color: #6b7280;
    margin-bottom: 0;
}


/* =================================== */
/* STYLES POUR GRANDS ÉCRANS (Desktop) */
/* =================================== */

/* "min-width: 1024px" veut dire: 
   "Seulement si la largeur de l'écran est de 1024px OU PLUS" */

@media (min-width: 1024px) {

    /* On remet le header en ligne */
    .controls {
        flex-direction: row;
        gap: 0; /* On enlève l'espace vertical */
    }

    /* On affiche le placeholder */
    .header-placeholder {
        display: block; /* On le ré-affiche */
        width: 200px;   /* On lui redonne sa largeur */
    }

    /* On remet les boutons de fichier à droite */
    .file-buttons {
        width: 200px;
        text-align: right;
    }

    /* On remet les panneaux en ligne */
    .panels {
        flex-direction: row; 
    }

    /* On remet les clés en ligne */
    .key-panel-content {
        flex-direction: row;
    }
}