/* =========================================
   VARIABLES & THEME GLOBAL
   ========================================= */
:root {
    --bg-dark: #070e1a;
    --bg-panel: rgba(13, 25, 48, 0.75);
    --blue-dark: #122340;
    --blue-mid: #1d3557;
    --cyan: #00f0ff;
    --cyan-dim: rgba(0, 240, 255, 0.2);
    --text-main: #e0fbfc;
    --text-muted: #94a3b8;
    --font-main: 'Rajdhani', sans-serif;
}

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

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-main);
    font-size: 1.1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    
    /* ANIMATED ENGINEERING GRID BACKGROUND */
    background-image: 
        linear-gradient(var(--cyan-dim) 1px, transparent 1px),
        linear-gradient(90deg, var(--cyan-dim) 1px, transparent 1px);
    background-size: 40px 40px;
    animation: panGrid 20s linear infinite;
    position: relative;
}

@keyframes panGrid {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* =========================================
   TYPOGRAPHIE & TITRES
   ========================================= */
h1 {
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--cyan);
    text-shadow: 0 0 10px var(--cyan-dim), 0 0 20px var(--cyan-dim);
    margin-bottom: 0.5rem;
    text-align: center;
}

h2 {
    font-size: 2rem;
    color: var(--text-main);
    margin-bottom: 2rem;
    border-bottom: 2px solid var(--cyan);
    padding-bottom: 5px;
}

h3 {
    color: var(--cyan);
    margin: 2rem 0 1rem 0;
    font-size: 1.5rem;
    letter-spacing: 1px;
}

/* =========================================
   BOUTONS ET LIENS
   ========================================= */
a {
    color: var(--cyan);
    text-decoration: none;
    transition: 0.3s ease;
    font-weight: 600;
}

a:hover {
    color: #fff;
    text-shadow: 0 0 8px var(--cyan);
}

button, input[type="submit"] {
    background: var(--bg-dark);
    border: 1px solid var(--cyan);
    color: var(--cyan) !important; /* Force la couleur pour le style général */
    padding: 10px 20px;
    font-family: var(--font-main);
    font-size: 1.2rem;
    font-weight: 600;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s ease;
    box-shadow: inset 0 0 5px var(--cyan-dim);
}

button:hover, input[type="submit"]:hover {
    background: var(--cyan);
    color: var(--bg-dark) !important;
    box-shadow: 0 0 15px var(--cyan);
}

button:disabled {
    border-color: var(--text-muted);
    color: var(--text-muted) !important;
    cursor: not-allowed;
    box-shadow: none;
}

/* =========================================
   FORMULAIRES (Login / Register)
   ========================================= */
form {
    background: var(--bg-panel);
    backdrop-filter: blur(5px);
    border: 1px solid var(--blue-mid);
    padding: 2rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    margin-bottom: 2rem;
}

label {
    font-size: 1.2rem;
    color: var(--text-muted);
}

input[type="text"], input[type="password"] {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--blue-mid);
    color: var(--text-main);
    padding: 10px;
    font-family: var(--font-main);
    font-size: 1.1rem;
    border-radius: 4px;
    transition: border 0.3s;
}

input[type="text"]:focus, input[type="password"]:focus {
    outline: none;
    border-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-dim);
}

/* =========================================
   HOMEPAGE (Users & Utiles)
   ========================================= */
#show-users {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
    max-width: 800px;
}

.show-users-child {
    background: var(--bg-panel);
    border: 1px solid var(--blue-mid);
    padding: 15px 30px;
    border-radius: 4px;
    transition: transform 0.3s, border-color 0.3s;
}

.show-users-child:hover {
    transform: translateY(-5px);
    border-color: var(--cyan);
    box-shadow: 0 5px 15px var(--cyan-dim);
}

#useful-buttons {
    margin-top: 3rem;
    display: flex;
    gap: 20px;
}

#useful-buttons a {
    border: 1px solid var(--text-muted);
    padding: 10px 20px;
    border-radius: 4px;
}

#useful-buttons a:hover {
    border-color: var(--cyan);
}

/* =========================================
   DASHBOARD & BIOGRAPHIE
   ========================================= */
.biography-container {
    width: 100%;
    max-width: 800px;
    background: var(--bg-panel);
    border: 1px solid var(--blue-mid);
    padding: 2rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

#display-biography {
    margin-bottom: 1rem;
    font-size: 1.2rem;
    line-height: 1.6;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-left: 4px solid var(--cyan);
}

textarea#edit-biography {
    width: 100%;
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--blue-mid);
    color: var(--text-main);
    padding: 15px;
    font-family: var(--font-main);
    font-size: 1.1rem;
    border-radius: 4px;
    resize: vertical;
    margin-bottom: 1rem;
}

textarea#edit-biography:focus {
    outline: none;
    border-color: var(--cyan);
}

/* =========================================
   MESSAGERIE (Mailbox)
   ========================================= */
.mailbox-container {
    display: flex;
    gap: 20px;
    width: 100%;
    max-width: 1000px;
    height: 400px;
    background: var(--bg-panel);
    border: 1px solid var(--blue-mid);
    border-radius: 8px;
    overflow: hidden;
}

#messages-icons {
    flex: 1;
    background: rgba(0, 0, 0, 0.3);
    overflow-y: auto;
    border-right: 1px solid var(--blue-mid);
}

/* Ciblage dynamique des divs générées par JS sans changer le JS ! */
#messages-icons > div {
    padding: 15px;
    border-bottom: 1px solid var(--blue-mid);
    cursor: pointer;
    transition: background 0.3s;
}

#messages-icons > div:hover {
    background: var(--blue-dark);
    border-left: 4px solid var(--cyan);
}

#messages-icons > div > div:first-child {
    font-weight: 700;
    color: var(--cyan);
    margin-bottom: 5px;
}

#messages-icons > div > div:last-child {
    font-size: 0.9rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#current-message {
    flex: 2;
    padding: 2rem;
    overflow-y: auto;
}

#current-message > div > div:first-child {
    font-size: 1.5rem;
    color: var(--cyan);
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--blue-mid);
    padding-bottom: 10px;
}

#current-message > div > div:last-child {
    font-size: 1.1rem;
    line-height: 1.6;
}

/* =========================================
   SCORES & QUIZ
   ========================================= */
#final-score {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.quiz-score {
    background: var(--bg-panel);
    padding: 15px;
    border: 1px solid var(--blue-mid);
    border-radius: 4px;
}

.quiz-score-title {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-main);
}

.quiz-score-result {
    float: right;
    color: var(--cyan);
    font-weight: bold;
}

.quiz-score-bar {
    width: 100%;
    height: 10px;
    background: rgba(0, 0, 0, 0.5);
    margin-top: 10px;
    border-radius: 5px;
    overflow: hidden;
}

.quiz-score-fill {
    height: 100%;
    background: var(--cyan);
    box-shadow: 0 0 10px var(--cyan);
    transition: width 1s ease-in-out;
}

/* =========================================
   INTERFACE DU QUIZ
   ========================================= */
#container-quiz {
    width: 100%;
    max-width: 800px;
    background: var(--bg-panel);
    padding: 2rem;
    border: 1px solid var(--cyan);
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.1);
    text-align: center;
}

#question {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: #fff;
}

#container-answers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 2rem;
}

.answer {
    background: var(--blue-dark);
    border: 1px solid var(--blue-mid);
    padding: 20px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.2s ease;
    color: #fff;
}

.answer:hover {
    background: var(--blue-mid);
    border-color: var(--cyan);
    box-shadow: 0 0 10px var(--cyan-dim);
}

/* Le JS applique style.backgroundColor = 'green' ou 'red' ici. 
   Cette ligne s'assure que le texte reste lisible sur fond vert/rouge */
.answer[style*="background-color"] {
    color: white !important;
    font-weight: bold;
    border-color: white !important;
}