:root {
    --bg-color: #1a1a2e;
    --container-bg: #22223b;
    --text-color: #e5e5e5;
    --input-bg: #3c3c5a;
    --button-primary: #8d40ff;
    --button-hover: #b380ff;
    --shadow-color: rgba(0, 0, 0, 0.4);
    --link-color: #4ddbff;
}

body.light-theme {
    --bg-color: #f4f4f9;
    --container-bg: #ffffff;
    --text-color: #333333;
    --input-bg: #e0e0e0;
    --button-primary: #007bff;
    --button-hover: #0056b3;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --link-color: #0056b3;
}

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

body {
    font-family: Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    transition: background-color 0.3s;
}

.container {
    background-color: var(--container-bg);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px var(--shadow-color);
    width: 100%;
    max-width: 450px;
    position: relative;
}

h1 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.8em;
    color: var(--text-color);
}

/* --- OUTPUT ET COPIE --- */
.output-container {
    display: flex;
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

#password-output {
    flex-grow: 1;
    padding: 12px;
    font-size: 1em;
    border: none;
    background-color: var(--input-bg);
    color: var(--text-color);
    cursor: text;
}

#copy-btn {
    background-color: var(--button-primary);
    color: white;
    border: none;
    padding: 12px 15px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#copy-btn:hover {
    background-color: var(--button-hover);
}

/* --- INDICATEUR DE FORCE --- */
.password-strength-container {
    display: flex;
    align-items: center;
    margin-top: 10px;
    margin-bottom: 15px;
    height: 15px;
    background-color: var(--input-bg);
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.strength-bar {
    height: 100%;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.strength-label {
    font-weight: bold;
    font-size: 0.9em;
    min-width: 60px;
    color: var(--text-color);
    padding-left: 10px;
    z-index: 2;
    position: absolute;
    right: 5px;
}

/* Couleurs de la barre */
.very-weak { background-color: #5d5d81; }
.weak { background-color: #ff4d4d; }
.medium { background-color: #ffc107; }
.strong { background-color: #4CAF50; }
.very-strong { background-color: #0080ff; }


/* --- OPTIONS ET BOUTONS --- */
label {
    display: block;
    margin-bottom: 10px;
    font-size: 0.9em;
}

input[type="range"] {
    width: 100%;
    margin-bottom: 20px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

#generate-btn {
    width: 100%;
    background-color: var(--button-primary);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 8px;
    font-size: 1.1em;
    cursor: pointer;
    transition: background-color 0.3s;
}

#generate-btn:hover {
    background-color: var(--button-hover);
}

/* --- LIEN DE CONVERSION (Alerte jaune) --- */
.security-alert {
    display: block;
    text-align: center;
    background-color: #FFC107;
    color: #333;
    padding: 15px 20px;
    margin: 20px auto;
    border-radius: 8px;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    transition: background-color 0.3s;
}

.security-alert:hover {
    background-color: #e0a800;
}

/* --- MONÉTISATION ET SEO --- */
.monetization-ad, .seo-text {
    margin-top: 25px;
    padding-top: 15px;
    border-top: 1px solid var(--input-bg);
}

.monetization-ad p {
    font-size: 0.9em;
    line-height: 1.4;
    text-align: center;
}

.monetization-ad a, .seo-text a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s;
}

.monetization-ad a:hover, .seo-text a:hover {
    color: var(--button-primary);
}

.seo-text h2 {
    font-size: 1.2em;
    margin-bottom: 10px;
    color: var(--text-color);
}

/* --- BOUTON DE THÈME --- */
#theme-toggle {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-color);
    cursor: pointer;
    font-size: 0.9em;
    padding: 5px;
    border-radius: 5px;
}

#theme-toggle:hover {
    background-color: var(--input-bg);
}

/* --- COOKIE BANNER --- */
.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--container-bg);
    border-top: 1px solid var(--input-bg);
    padding: 15px 20px;
    display: none;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.cookie-banner p {
    font-size: 0.9em;
    margin: 0;
}

.cookie-actions button {
    background-color: var(--button-primary);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    text-decoration: none;
    font-size: 0.9em;
    margin-left: 10px;
    transition: background-color 0.3s;
}

.cookie-actions button:hover {
    background-color: var(--button-hover);
}

/* --- MODALE DE CONFIDENTIALITÉ (CORRIGÉ POUR CENTRAGE FIXE) --- */
.modal {
    display: none; /* L'état initial DOIT être 'none' */
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.7);

    /* Ces règles s'appliquent seulement quand le JS met display: flex */
    align-items: center;
    justify-content: center;
}

.modal-content {
    background-color: var(--container-bg);
    color: var(--text-color);
    padding: 25px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 10px;
    position: relative;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);

    /* Gestion du défilement interne */
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content h2 {
    color: var(--button-primary);
    margin-bottom: 15px;
    font-size: 1.5em;
}

.modal-content ul {
    margin-left: 20px;
    margin-bottom: 15px;
    list-style-type: disc;
}

.close-btn {
    color: var(--text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close-btn:hover,
.close-btn:focus {
    color: #f00;
    text-decoration: none;
    cursor: pointer;
}

/* --- BOUTON FLOTTANT DE RAPPEL --- */
#open-settings-btn {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background-color: var(--container-bg);
    color: var(--text-color);
    border: 1px solid var(--input-bg);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    font-size: 1.5em;
    cursor: pointer;
    box-shadow: 0 2px 10px var(--shadow-color);
    z-index: 999;
    display: none;
    justify-content: center;
    align-items: center;
}

#open-settings-btn:hover {
    background-color: var(--input-bg);
}

/* --- RESPONSIVE DESIGN --- */
@media (max-width: 500px) {
    .container {
        padding: 25px 20px;
    }
    h1 {
        font-size: 1.6em;
    }
    .output-container {
        flex-direction: column;
    }
    #password-output {
        border-radius: 8px 8px 0 0;
    }
    #copy-btn {
        border-radius: 0 0 8px 8px;
    }
    .cookie-banner {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
    .cookie-actions {
        margin-top: 10px;
        display: flex;
        width: 100%;
    }
    .cookie-actions button {
        flex-grow: 1;
        text-align: center;
        margin: 0 5px 0 0;
    }
    .modal-content {
        width: 90%;
    }
    #open-settings-btn {
        left: 10px;
        bottom: 10px;
    }
}