/* === Variables et reset === */
:root {
    --purple-dark: #2d1b69;
    --purple-mid: #5b3a9e;
    --purple-light: #7c5cbf;
    --blue: #3a7bd5;
    --green: #27ae60;
    --orange: #e67e22;
    --red: #e74c3c;
    --pink: #e84393;
    --teal: #00b894;
    --yellow: #f1c40f;
    --gray-bg: #f0f2f5;
    --white: #ffffff;
    --text: #333;
    --text-light: #777;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 10px;
    --radius-sm: 6px;
    --sidebar-width: 200px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--gray-bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a {
    text-decoration: none;
    color: inherit;
}

/* === Header === */
header {
    background: linear-gradient(135deg, var(--purple-dark) 0%, var(--purple-mid) 50%, var(--blue) 100%);
    padding: 20px 30px;
    color: var(--white);
    position: relative;
    overflow: hidden;
    display: grid !important;
    grid-template-columns: 180px minmax(0, 1fr) 180px !important;
    align-items: center;
    gap: 20px;
    box-sizing: border-box;
    width: 100%;
}

header::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 50%;
    pointer-events: none;
}

header::after {
    content: '';
    position: absolute;
    bottom: -40px;
    right: 80px;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    pointer-events: none;
}

header .header-logo {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    min-height: 60px;
    min-width: 0;
    overflow: hidden;
}

header .header-logo img {
    max-height: 70px !important;
    max-width: 160px !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
    display: block;
}

header .header-titre {
    position: relative;
    z-index: 1;
    text-align: center !important;
    min-width: 0;
    transform: translateX(calc(var(--sidebar-width) / 2));
}

header .header-spacer {
    /* Colonne de droite : équilibre visuel pour centrer le titre */
}

header h1 {
    font-size: 1.6rem;
    font-weight: 700;
}

header .sous-titre {
    font-size: 0.95rem;
    opacity: 0.85;
    margin-top: 4px;
}

@media (max-width: 700px) {
    header {
        grid-template-columns: 80px minmax(0, 1fr) 80px !important;
        padding: 15px;
        gap: 10px;
    }
    header .header-logo img {
        max-height: 50px !important;
        max-width: 70px !important;
    }
    header h1 {
        font-size: 1.2rem;
    }
    header .header-titre {
        transform: none;
    }
}

/* === Layout principal === */
.container {
    display: flex;
    flex: 1;
}

/* === Sidebar === */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background: var(--purple-dark);
    padding: 15px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sidebar-title {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 8px 8px 4px;
    font-weight: 600;
}

.sidebar a.bureau-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.88rem;
    transition: all 0.2s;
}

.sidebar a.bureau-link:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar a.bureau-link.active {
    background: rgba(255, 255, 255, 0.15);
    color: var(--white);
}

.sidebar .bureau-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--white);
    flex-shrink: 0;
}

.sidebar a.sidebar-recap-btn {
    display: block;
    text-align: center;
    padding: 11px 12px;
    background: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    color: var(--purple-dark);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}

.sidebar a.sidebar-recap-btn:hover {
    background: #f0eaff;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

.sidebar a.sidebar-top-btn {
    display: block;
    text-align: center;
    padding: 9px 12px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    color: var(--white);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.2s;
}

.sidebar a.sidebar-top-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar a.admin-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.85rem;
    transition: all 0.2s;
}

.sidebar a.sidebar-bottom-btn {
    display: block;
    text-align: center;
    padding: 9px 12px;
    margin-top: auto;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: var(--radius-sm);
    color: var(--white);
    font-size: 0.88rem;
    font-weight: 600;
    transition: all 0.2s;
}

.sidebar a.sidebar-bottom-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.sidebar a.admin-btn:hover {
    color: var(--white);
    background: rgba(255, 255, 255, 0.1);
}

/* === Contenu principal === */
.content {
    flex: 1;
    padding: 30px;
}

.content h2 {
    margin-bottom: 20px;
    font-size: 1.3rem;
    color: var(--purple-dark);
}

/* === Cartes === */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 25px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--purple-dark);
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--gray-bg);
}

/* === Tableaux === */
table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
}

table th,
table td {
    padding: 12px 16px;
    text-align: left;
}

table th {
    background: var(--purple-dark);
    color: var(--white);
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

table th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

table th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

table td {
    border-bottom: 1px solid #eee;
}

table tr:hover td {
    background: #f8f9fa;
}

/* === Barre de progression === */
.progress-bar {
    height: 8px;
    background: #eee;
    border-radius: 4px;
    overflow: hidden;
    min-width: 100px;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

/* === Badges / étiquettes === */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-purple { background: #ede7f6; color: var(--purple-mid); }
.badge-green { background: #e8f5e9; color: var(--green); }
.badge-blue { background: #e3f2fd; color: var(--blue); }
.badge-orange { background: #fff3e0; color: var(--orange); }

/* === Footer === */
footer {
    background: var(--white);
    border-top: 3px solid var(--purple-mid);
    padding: 12px 30px;
    text-align: center;
    color: var(--text-light);
    font-size: 0.85rem;
}

/* === Messages === */
.message {
    padding: 12px 16px;
    margin-bottom: 15px;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
}

.message.success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid var(--green);
}

.message.error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid var(--red);
}

/* === Boutons === */
.btn {
    display: inline-block;
    padding: 9px 22px;
    background: var(--purple-mid);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.2s, transform 0.1s;
}

.btn:hover {
    background: var(--purple-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--gray-mid, #6c757d);
}

.btn-secondary:hover {
    background: var(--gray-dark, #495057);
}

.btn-danger {
    background: var(--red);
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-small {
    padding: 4px 12px;
    font-size: 0.82rem;
}

/* === Formulaires === */
.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    max-width: 400px;
    padding: 9px 14px;
    border: 1px solid #ddd;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--purple-mid);
    box-shadow: 0 0 0 3px rgba(91, 58, 158, 0.1);
}

/* === Texte vide === */
.empty {
    color: var(--text-light);
    font-style: italic;
    padding: 20px 0;
}
