* { margin:0; padding:0; box-sizing:border-box; font-family:Arial, sans-serif; }

body {
    display:flex;
    background:#0f172a;
    color:#e2e8f0;
    min-height: 100vh;
}

/* ═══════════════════════════════════════ */
/* LOGIN PAGE */
/* ═══════════════════════════════════════ */

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100vh;
}

.login-card {
    background: #1e293b;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    width: 100%;
    max-width: 400px;
}

.login-card h1 {
    color: #38bdf8;
    margin-bottom: 10px;
    font-size: 1.8rem;
}

.login-card p {
    color: #94a3b8;
    margin-bottom: 30px;
}

.login-card input {
    width: 100%;
    padding: 12px;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 6px;
    color: #e2e8f0;
    font-size: 1rem;
    margin-bottom: 20px;
}

.login-card input:focus {
    outline: none;
    border-color: #38bdf8;
}

.login-card button {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.login-card button:hover {
    transform: translateY(-2px);
}

.login-error {
    background: #7f1d1d;
    color: #fca5a5;
    padding: 10px;
    border-radius: 6px;
    margin-top: 15px;
    display: none;
}

.login-error.show {
    display: block;
}

/* ═══════════════════════════════════════ */
/* DASHBOARD */
/* ═══════════════════════════════════════ */

.dashboard {
    display: none;
    width: 100%;
}

.dashboard.active {
    display: flex;
}

/* ═══════════════════════════════════════ */
/* HEADER AVEC NOTIFICATIONS */
/* ═══════════════════════════════════════ */

.header {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 70px;
    background: #1e293b;
    border-bottom: 1px solid #334155;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
    z-index: 100;
}

.header-title {
    font-size: 24px;
    font-weight: 600;
    color: #38bdf8;
}

.notifications {
    display: flex;
    gap: 20px;
    align-items: center;
}

.notif-item {
    position: relative;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    transition: 0.2s;
}

.notif-item:hover {
    background: #334155;
}

.notif-icon {
    font-size: 24px;
    position: relative;
}

.notif-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #dc2626;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.notif-badge.zero {
    background: #334155;
    color: #64748b;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.15); }
}

.notif-badge:not(.zero) {
    animation: pulse 2s infinite;
}

/* Dropdown notifications */
.dropdown {
    display: none;
    position: absolute;
    top: 50px;
    right: 0;
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    width: 350px;
    max-height: 400px;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
    z-index: 200;
}

.dropdown.active {
    display: block;
}

.dropdown-header {
    padding: 15px 20px;
    border-bottom: 1px solid #334155;
    font-weight: 600;
    color: #38bdf8;
}

.dropdown-item {
    padding: 15px 20px;
    border-bottom: 1px solid #334155;
    cursor: pointer;
    transition: 0.2s;
}

.dropdown-item:hover {
    background: #334155;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item-title {
    font-weight: 600;
    margin-bottom: 4px;
}

.dropdown-item-meta {
    font-size: 12px;
    color: #64748b;
}

.dropdown-empty {
    padding: 40px 20px;
    text-align: center;
    color: #64748b;
}

/* ═══════════════════════════════════════ */
/* SIDEBAR RÉORGANISÉE */
/* ═══════════════════════════════════════ */

.sidebar {
    width: 280px;
    min-height: 100vh;
    background: #111827;
    padding: 20px;
    position: fixed;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar h2 {
    margin-bottom: 30px;
    font-size: 18px;
    color: #38bdf8;
    text-align: center;
}

.section-title {
    color: #64748b;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 20px 0 10px 0;
    font-weight: 600;
}

.section-title:first-of-type {
    margin-top: 0;
}

.sidebar button {
    width: 100%;
    background: none;
    border: none;
    color: #cbd5e1;
    padding: 12px 15px;
    text-align: left;
    cursor: pointer;
    border-radius: 8px;
    margin-bottom: 6px;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar button:hover {
    background: #1e293b;
}

.sidebar button.active {
    background: #1e3a8a;
    color: #60a5fa;
}

.badge-count {
    background: #dc2626;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.badge-count.zero {
    background: #334155;
    color: #64748b;
}

.logout-btn {
    margin-top: auto;
    background: #dc2626 !important;
    color: white !important;
    font-weight: 600;
    text-align: center !important;
    justify-content: center !important;
}

.logout-btn:hover {
    background: #b91c1c !important;
}

/* ═══════════════════════════════════════ */
/* MAIN CONTENT */
/* ═══════════════════════════════════════ */

.main {
    margin-left: 280px;
    margin-top: 70px;
    padding: 30px;
    width: 100%;
}

.section {
    display: none;
}

.section.active {
    display: block;
}

.card {
    background: #1e293b;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
}

.card h3 {
    margin-bottom: 15px;
    color: #38bdf8;
}

/* ═══════════════════════════════════════ */
/* DASHBOARD STATS */
/* ═══════════════════════════════════════ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: #1e293b;
    border: 1px solid #334155;
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    transition: 0.2s;
}

.stat-card:hover {
    border-color: #38bdf8;
    transform: translateY(-2px);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #60a5fa;
    margin-bottom: 8px;
}

.stat-card.danger .stat-number {
    color: #ef4444;
}

.stat-card.success .stat-number {
    color: #22c55e;
}

.stat-label {
    color: #94a3b8;
    font-size: 14px;
}

/* ═══════════════════════════════════════ */
/* TABLES */
/* ═══════════════════════════════════════ */

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 10px;
    border-bottom: 1px solid #334155;
    text-align: left;
}

th {
    color: #94a3b8;
}

.status-active { color: #22c55e; }
.status-expired { color: #ef4444; }
.status-pending { color: #f59e0b; }

/* ═══════════════════════════════════════ */
/* BUTTONS */
/* ═══════════════════════════════════════ */

.btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    transition: 0.2s;
}

.btn:hover {
    opacity: 0.8;
}

.btn-primary { background: #2563eb; color: white; }
.btn-secondary { background: #475569; color: white; }
.btn-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-success:hover {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

.btn-sm {
    padding: 4px 8px;
    font-size: 11px;
}

/* ═══════════════════════════════════════ */
/* FORMS */
/* ═══════════════════════════════════════ */

textarea {
    width: 100%;
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 6px;
    margin-top: 10px;
    font-family: Arial, sans-serif;
}

input, select {
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 8px;
    border-radius: 6px;
}

.input-field {
    background: #0f172a;
    border: 1px solid #334155;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 6px;
}

/* ═══════════════════════════════════════ */
/* ALERTS & MESSAGES */
/* ═══════════════════════════════════════ */

.alert {
    padding: 15px;
    border-radius: 6px;
    margin-bottom: 20px;
}

.alert-info {
    background: #1e3a8a;
    border-left: 4px solid #3b82f6;
}

.alert-success {
    background: #14532d;
    border-left: 4px solid #22c55e;
}

.alert-warning {
    background: #78350f;
    border-left: 4px solid #f59e0b;
}

.badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge.published { background: #166534; color: #4ade80; }
.badge.upcoming { background: #92400e; color: #fbbf24; }

/* ═══════════════════════════════════════ */
/* ARTICLES */
/* ═══════════════════════════════════════ */

.article-item {
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px;
    margin: 12px 0;
}

.article-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.article-title {
    font-size: 1.1rem;
    color: #e2e8f0;
    font-weight: 600;
    flex: 1;
}

.article-meta {
    color: #64748b;
    font-size: 0.85rem;
    margin: 4px 0;
}

.article-actions {
    display: flex;
    gap: 8px;
    margin-top: 12px;
}

/* ═══════════════════════════════════════ */
/* MODAL */
/* ═══════════════════════════════════════ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 12px;
    padding: 24px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-close {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
}

.modal-close:hover { color: #e2e8f0; }

label {
    display: block;
    color: #94a3b8;
    font-size: 0.85rem;
    margin-bottom: 4px;
    margin-top: 12px;
}

label:first-child { margin-top: 0; }

.row { 
    display: flex; 
    gap: 12px; 
    align-items: flex-end; 
    flex-wrap: wrap; 
}

.msg { 
    padding: 10px; 
    border-radius: 6px; 
    margin-top: 12px; 
    font-size: 0.85rem; 
}

.msg.success { 
    background: #166534; 
    color: #4ade80; 
    border: 1px solid #22c55e; 
}

.msg.error { 
    background: #7f1d1d; 
    color: #fca5a5; 
    border: 1px solid #ef4444; 
}

/* ════════════════════════════════════════ */
/* RESPONSIVE MOBILE */
/* ════════════════════════════════════════ */

/* Zone scroll pour tableaux */
.table-container {
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

/* Tables scrollables horizontalement */
table {
    display: block;
    overflow-x: auto;
}

/* Bouton menu hamburger */
.mobile-menu {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1001;
    background: #3b82f6;
    color: white;
    border: none;
    padding: 5px 8px;
    font-size: 14px;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.mobile-menu:hover {
    background: #2563eb;
}

/* MEDIA QUERY MOBILE */
@media (max-width: 900px) {
    
    /* Menu hamburger visible */
    .mobile-menu {
        display: block;
    }
    
    /* Sidebar cachée par défaut */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        height: 100%;
        transition: left 0.3s ease;
        z-index: 1000;
    }
    
    /* Sidebar ouverte */
    .sidebar.open {
        left: 0;
    }
    
    /* Main prend toute la largeur */
    .main {
        margin-left: 0;
        padding: 20px 15px;
    }
    
    /* Header prend toute la largeur */
    .header {
        left: 0;
        padding-left: 70px;
    }
    
    /* Boutons plus gros */
    .btn {
        padding: 12px 16px;
        font-size: 14px;
    }
    
    .btn-sm {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    /* Boutons sidebar plus tactiles */
    .sidebar button {
        padding: 16px;
        font-size: 15px;
    }
    
    /* Cards avec moins de padding */
    .card {
        padding: 15px;
    }
    
    /* Modals pleine largeur */
    .modal-content {
        margin: 10px;
        max-width: calc(100% - 20px);
    }
    
    /* Stats grid en colonne */
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* MEDIA QUERY TABLETTE */
@media (min-width: 901px) and (max-width: 1200px) {
    .sidebar {
        width: 240px;
    }
    
    .main {
        margin-left: 240px;
    }
    
    .header {
        left: 240px;
    }
}

/* ════════════════════════════════════════
   AGENDA - STYLES
   ════════════════════════════════════════ */

#agenda-calendar {
    width: 100%;
    overflow-x: auto;
}

#agenda-calendar > div {
    min-width: 700px;
}

/* Cases calendrier */
#agenda-calendar > div > div {
    transition: all 0.2s;
}

#agenda-calendar > div > div:hover {
    transform: scale(1.02);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Événements dans les cases */
#agenda-calendar > div > div > div[onclick] {
    transition: all 0.15s;
}

#agenda-calendar > div > div > div[onclick]:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* Boutons filtres actifs */
[id^="filter-"].active {
    background: #3b82f6;
    color: white;
}

/* Responsive calendrier */
@media (max-width: 900px) {
    #agenda-calendar > div {
        min-width: 100%;
        font-size: 12px;
    }
    
    #agenda-calendar > div > div {
        min-height: 80px;
        padding: 5px;
    }
    
    #agenda-calendar > div > div > div[onclick] {
        font-size: 10px;
        padding: 3px;
    }
    
    #agenda-search {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Navigation agenda mobile */
    .card > div:first-of-type {
        flex-direction: column;
        gap: 8px;
    }
    
    .card > div:first-of-type button {
        width: 100%;
        font-size: 13px;
    }
    
    #agenda-month-title {
        font-size: 16px !important;
        min-width: auto !important;
    }
}

/* Z-INDEX MODALES AGENDA */
#modal-day-view {
    z-index: 1000;
}

#modal-event-detail,
#modal-edit-event,
#modal-create-event {
    z-index: 1100;
}