/* ================= Reset & Police ================= */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
    background: #1b1b2f; /* fond sombre violet foncé */
    color: #f0e6ff;      /* texte clair lilas */
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow-x: hidden;
    padding: 20px;
}

/* ================= Fond animé ================= */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle, rgba(180,150,255,0.05) 0%, transparent 70%);
    animation: rotateBg 60s linear infinite;
    z-index: -2;
}
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-radial-gradient(circle at center, rgba(180,150,255,0.02) 0px, rgba(180,150,255,0.02) 2px, transparent 2px, transparent 20px);
    animation: moveBg 120s linear infinite;
    z-index: -1;
}
@keyframes rotateBg { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes moveBg { from { background-position: 0 0; } to { background-position: 1000px 1000px; } }

/* ================= Screens ================= */
.screen {
    width: 90%;
    max-width: 1000px;
    padding: 30px;
    background: #2a1b3b; /* violet foncé */
    border-radius: 25px;
    box-shadow: 0 15px 40px rgba(0,0,0,0.6);
    text-align: center;
    animation: fadeIn 0.5s ease;
    position: relative;
    overflow: hidden;
}
.hidden { display: none; }

/* ================= Login ================= */
.login-screen { width: 360px; }

/* ================= Panel Header ================= */
.panel-header {
    background: #311e4c; /* violet moyen */
    padding: 20px;
    border-radius: 20px 20px 0 0;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}
.panel-header h1 {
    font-size: 2.5rem;
    color: #c084fc; /* lilas clair */
    letter-spacing: 2px;
}

/* ================= Panel Body ================= */
.panel-body {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

/* ================= Devoirs Grid & Cards ================= */
.devoirs-grid {
    flex: 6;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 18px;
}

.devoir-card {
    background: #3b1f55; /* violet sombre */
    padding: 20px;
    border-radius: 18px;
    text-align: left;
    box-shadow: 0 6px 20px rgba(0,0,0,0.4);
    transition: all 0.45s ease;
    position: relative;
    cursor: pointer;
}
.devoir-card:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 0 20px 40px rgba(192,132,252,0.45);
}
.devoir-card.completed {
    background: #2d4b2d; /* vert foncé pour les devoirs terminés */
}

/* Delete button */
.devoir-card button.delete-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #f472b6; /* rose vif */
    color: white;
    border-radius: 12px;
    padding: 6px 12px;
    font-size: 13px;
    border: none;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.25s ease;
}
.devoir-card button.delete-btn:hover {
    background: #fb94c2;
    transform: scale(1.05);
}

/* ================= Utilisateurs connectés ================= */
.connected-users-window {
    flex: 1;
    background: #291a40; /* violet foncé */
    padding: 18px;
    border-radius: 20px;
    max-height: 320px;
    overflow-y: auto;
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}
.connected-users-window h3 { margin-bottom: 12px; color: #c084fc; font-size: 1.2rem; }
.connected-users-window ul { list-style: none; }
.connected-users-window li { margin-bottom: 6px; font-size: 0.95rem; }

/* Scrollbar stylisée pour utilisateurs connectés */
.connected-users-window::-webkit-scrollbar {
    width: 10px;
    border-radius: 10px;
}
.connected-users-window::-webkit-scrollbar-track {
    background: #2a1b3b;
    border-radius: 10px;
}
.connected-users-window::-webkit-scrollbar-thumb {
    background: #c084fc;
    border-radius: 10px;
    border: 2px solid #291a40;
}
.connected-users-window::-webkit-scrollbar-thumb:hover {
    background: #a05edb;
}
/* Firefox */
.connected-users-window {
    scrollbar-width: thin;
    scrollbar-color: #c084fc #2a1b3b;
}

/* ================= Inputs & Textarea ================= */
input, textarea, label { width: 100%; margin: 8px 0; }
input, textarea {
    padding: 14px;
    border-radius: 12px;
    border: none;
    background: #3b1f55; /* violet sombre */
    color: #f0e6ff;
}
textarea { resize: none; height: 90px; }

/* ================= Buttons ================= */
button {
    padding: 12px 28px;
    border: none;
    border-radius: 15px;
    font-size: 16px;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.3s ease;
}
button:hover { 
    transform: translateY(-2px) scale(1.02); 
    box-shadow: 0 8px 25px rgba(192,132,252,0.45); 
}
.orange-btn { background-color: #c084fc; color: white; }
.logout-btn { background-color: #4c3b6b; color: #f0e6ff; margin-top: 12px; }

/* ================= Animations ================= */
@keyframes fadeIn { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }

/* ================= Responsive ================= */
@media(max-width:900px){
    .panel-body { flex-direction: column; }
    .connected-users-window { max-height: 200px; }
    .login-screen { width: 90%; }
    .devoirs-grid { grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); }
}
