/* ===== Variables CSS ===== */
:root {
    --primary-color: #6E2C91; /* Violet profond */
    --secondary-color: #8A4F7D; /* Violet secondaire */
    --accent-color: #D16BA5; /* Violet clair pour accents */
    --text-color: #FFFFFF; /* Texte clair */
    --text-dark: #1A1A2E; /* Texte foncé */
    --background-light: #F8F9FA; /* Fond clair */
    --background-dark: #16213E; /* Fond foncé */
    --background-gradient: linear-gradient(135deg, #6E2C91, #8A4F7D);
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition: all 0.3s ease;
    --font-main: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --block-border: 1px solid rgba(110, 44, 145, 0.2);
    --block-bg: rgba(255, 255, 255, 0.98);
    --block-bg-dark: rgba(26, 34, 46, 0.98);
}

/* ===== Reset & Base Styles ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-main);
}

body {
    font-family: var(--font-main);
    margin: 0;
    padding: 0;
    background-color: var(--background-light);
    min-height: 100vh;
    color: var(--text-dark);
    line-height: 1.6;
}

/* ===== Layout ===== */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 10px;
}

/* ===== Header ===== */
header {
    background: var(--block-bg);
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    padding: 15px 20px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.nav-links a {
    padding: 8px 12px;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
}

.nav-links a:hover {
    background: rgba(110, 44, 145, 0.1);
}

.session-box {
    background: var(--background-gradient);
    padding: 12px;
    border-radius: var(--border-radius);
    color: var(--text-color);
    box-shadow: var(--box-shadow);
    text-align: center;
    min-width: 180px;
    margin-right: 15px;
    border: var(--block-border);
}

.session-box p {
    margin-bottom: 8px;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    font-size: 0.9em;
}

.session-box button, .session-box a {
    display: block;
    width: calc(100% - 10px);
    margin: 6px auto;
    padding: 8px;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    background: transparent;
    color: var(--text-color);
    font-size: 0.85em;
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
}

.session-box button:hover, .session-box a:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* ===== Main Content ===== */
main {
    padding: 20px;
    margin-bottom: 30px;
}

.content-box {
    background: var(--block-bg);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    width: 100%;
    max-width: 800px;
    margin: 0 auto 30px;
    border: var(--block-border);
}

.content-box h2 {
    margin-bottom: 15px;
    font-size: 1.8em;
    color: var(--primary-color);
}

.line {
    border-bottom: 2px solid #ddd;
    margin: 20px auto;
    width: 80%;
}

/* ===== Software Section ===== */
.software-section {
    margin-top: 30px;
    text-align: center;
}

.software-section h3 {
    font-size: 1.6em;
    margin-bottom: 20px;
    color: var(--primary-color);
}

.software-select {
    background: var(--block-bg-dark);
    padding: 15px;
    border-radius: var(--border-radius);
    border: var(--block-border);
    margin: 20px auto;
    max-width: 500px;
    width: 100%;
}

.software-select select {
    display: block;
    width: 100%;
    padding: 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 1em;
    margin-bottom: 10px;
}

.software-select option {
    background: var(--primary-color);
    padding: 10px;
}

.image-container {
    margin: 20px auto;
    text-align: center;
    max-width: 100%;
}

.image-container img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    display: block;
    margin: 0 auto;
}

/* ===== Popups ===== */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    z-index: 999;
}

.overlay.active {
    display: block;
}

.popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--block-bg-dark);
    padding: 30px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    z-index: 1000;
    display: none;
    box-shadow: var(--box-shadow);
    border: var(--block-border);
}

.popup.active {
    display: block;
}

.popup form {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.popup form input {
    padding: 12px;
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 1em;
}

.popup form button {
    padding: 12px;
    border-radius: var(--border-radius);
    background: var(--primary-color);
    color: var(--text-color);
    border: none;
    cursor: pointer;
    transition: var(--transition);
    font-size: 1em;
}

.popup form button:hover {
    background: var(--secondary-color);
}

.popup .close {
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.5em;
    cursor: pointer;
}

.error-message {
    color: #ff6b6b;
    margin-top: 10px;
    text-align: center;
    font-weight: bold;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    padding: 20px;
    margin-top: auto;
    border-top: 1px solid rgba(110, 44, 145, 0.2);
    background: var(--block-bg-dark);
    color: var(--text-color);
}

/* ===== Page "Logiciels" ===== */
body.software-page {
    background: var(--background-gradient);
    color: var(--text-color);
}

body.software-page .content-box {
    background: var(--block-bg-dark);
    color: var(--text-color);
}

/* ===== Page "Maintenance" ===== */
body.maintenance-page {
    background: var(--background-gradient);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    text-align: center;
}

/* ===== Page "Romans" ===== */
.carousel-section {
    width: 100%;
    max-width: 1000px;
    margin: 30px auto;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--box-shadow);
    position: relative;
}

.splide__slide {
    position: relative;
    height: 400px;
}

.splide__slide a {
    display: block;
    width: 100%;
    height: 100%;
}

.splide__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.slide-title {
    position: absolute;
    bottom: 15px;
    left: 15px;
    background: rgba(0, 0, 0, 0.7);
    color: var(--text-color);
    padding: 10px 15px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 1.3em;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}

/* ===== Page "Utilisateurs" ===== */
.users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    justify-content: center;
    margin: 20px 0;
}

.user-card {
    background: var(--block-bg-dark);
    border: var(--block-border);
    border-radius: var(--border-radius);
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.user-card:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-5px);
}

.user-card img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 2px solid var(--accent-color);
}

.user-card h3 {
    margin-bottom: 5px;
    font-size: 1.1em;
    color: var(--text-color);
}

.user-card p {
    font-size: 0.9em;
    opacity: 0.8;
    color: var(--text-color);
}

/* ===== Page "Classement" ===== */
table {
    color: var(--text-color);
    width: 100%;
    border-collapse: collapse;
    margin: 20px auto;
}

table th, table td {
    padding: 10px;
    border: 1px solid #ddd;
    text-align: left;
}

table th {
    background: var(--primary-color);
    text-align: center;
    color: var(--text-color);
}

table td {
    background: var(--secondary-color);
    color: var(--text-color);
}

table tbody tr:nth-child(even) {
    background: rgba(110, 44, 145, 0.5);
}

.rank {
    font-weight: bold;
    text-align: center;
}

/* ===== Page "Mon Compte" ===== */
.profile-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.profile-images {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
}

.profile-image-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.profile-image {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--accent-color);
    cursor: pointer;
    transition: var(--transition);
}

.profile-image:hover {
    transform: scale(1.05);
}

.profile-actions {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
}

.profile-actions button {
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    background: #ff4d4d;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
    font-weight: bold;
}

.profile-actions button:hover {
    background: #ff1a1a;
}

.user-info {
    text-align: left;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.user-info p {
    margin-bottom: 10px;
    font-size: 1.1em;
    color: var(--text-dark);
}

.user-info strong {
    color: var(--accent-color);
}

.links-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.links-container a {
    padding: 10px 20px;
    border: 1px solid var(--accent-color);
    border-radius: var(--border-radius);
    color: var(--text-dark);
    text-decoration: none;
    transition: var(--transition);
    background: var(--block-bg);
}

.links-container a:hover {
    background: rgba(110, 44, 145, 0.1);
}

/* ===== Page "Admin Dashboard" ===== */
.admin-form {
    background: var(--block-bg-dark);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    text-align: center;
    width: 100%;
    max-width: 600px;
    margin: 20px auto;
    border: var(--block-border);
}

.admin-form form {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

.admin-form select, .admin-form input, .admin-form button {
    padding: 10px;
    border-radius: var(--border-radius);
    border: 1px solid var(--accent-color);
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-color);
    font-size: 1em;
}

.admin-form button {
    background: var(--primary-color);
    cursor: pointer;
    transition: var(--transition);
}

.admin-form button:hover {
    background: var(--secondary-color);
}

/* ===== Responsive ===== */
@media only screen and (max-width: 768px) {
    header {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 15px;
    }

    .header-left, .header-right {
        min-width: 100%;
        margin-right: 0;
        justify-content: center;
        margin-bottom: 15px;
    }

    .session-box {
        margin-right: 0;
        min-width: 100%;
    }

    .nav-links {
        justify-content: center;
    }

    main {
        margin-top: 30px;
    }

    .users-grid {
        grid-template-columns: 1fr;
    }

    .filter-form form {
        flex-direction: column;
        align-items: center;
    }

    .filter-form select, .filter-form input, .filter-form button {
        width: 100%;
    }

    .software-select {
        width: 95%;
    }

    .profile-images {
        flex-direction: column;
    }

    .profile-actions {
        flex-direction: column;
        align-items: center;
    }

    .splide__slide {
        height: 250px;
    }

    .slide-title {
        font-size: 1em;
        bottom: 10px;
        left: 10px;
        padding: 6px 10px;
    }
}
