/* =========================================
   PGORACC V2 - Design System
   ========================================= */

:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --secondary: #64748b;
    --success: #10b981;
    --success-light: #d1fae5;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --info: #3b82f6;
    --info-light: #dbeafe;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --bg-sidebar: #1e293b;
    --bg-sidebar-hover: #334155;
    --text: #1e293b;
    --text-light: #64748b;
    --text-sidebar: #94a3b8;
    --border: #e2e8f0;
    --radius: 8px;
    --radius-lg: 12px;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --sidebar-w: 260px;
}

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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-hover); }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    display: flex; flex-direction: column;
    z-index: 100;
}

.sidebar-header {
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header h1 {
    font-size: 1.3rem; font-weight: 700; color: #fff; letter-spacing: -0.02em;
}

.sidebar-header small { font-size: 0.7rem; color: var(--text-sidebar); }

.sidebar-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 0; }
.sidebar-nav ul { list-style: none; }

.nav-section {
    padding: 16px 20px 6px;
    font-size: 0.65rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.1em;
    color: #475569;
}

.nav-item a, .nav-item button {
    display: flex; align-items: center; gap: 12px;
    width: 100%; padding: 10px 20px;
    color: var(--text-sidebar); font-size: 0.85rem;
    border: none; background: none; cursor: pointer;
    transition: all 0.15s; text-align: left; font-family: inherit;
}

.nav-item a:hover, .nav-item button:hover {
    background: var(--bg-sidebar-hover); color: #e2e8f0;
}

.nav-item.active > a { background: var(--primary); color: #fff; font-weight: 500; }
.nav-item a i, .nav-item button i { width: 18px; text-align: center; font-size: 0.9rem; opacity: 0.6; }
.nav-item.active > a i { opacity: 1; }

.nav-arrow { margin-left: auto; font-size: 0.6rem; transition: transform 0.2s; }
.nav-item.open .nav-arrow { transform: rotate(180deg); }

.sub-menu { display: none; background: rgba(0,0,0,0.12); }
.nav-item.open .sub-menu { display: block; }

.sub-menu a {
    padding: 8px 20px 8px 50px; font-size: 0.8rem;
    color: var(--text-sidebar);
}
.sub-menu a:hover { color: #fff; background: var(--bg-sidebar-hover); }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
    font-size: 0.72rem; color: #475569; line-height: 1.5;
}
.sidebar-footer a { color: #fbbf24; }
.sidebar-footer a:hover { color: #fcd34d; }

.sidebar-user {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 12px; padding-bottom: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-avatar {
    width: 32px; height: 32px; border-radius: 50%;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 0.75rem; font-weight: 600;
}

.sidebar-user-name { font-size: 0.8rem; color: #e2e8f0; font-weight: 500; }
.sidebar-user-role { font-size: 0.68rem; color: #64748b; }

/* ===== MAIN CONTENT ===== */
main {
    margin-left: var(--sidebar-w);
    padding: 32px;
    min-height: 100vh;
}

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; font-weight: 700; letter-spacing: -0.02em; }
.page-header p { color: var(--text-light); font-size: 0.875rem; margin-top: 4px; }

/* ===== CARDS ===== */
.card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); box-shadow: var(--shadow);
}

.card-header {
    padding: 18px 24px; border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 1rem; font-weight: 600; }
.card-body { padding: 24px; }

/* ===== STATS ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px; margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card); border-radius: var(--radius-lg);
    border: 1px solid var(--border); padding: 20px; box-shadow: var(--shadow);
}
.stat-icon {
    width: 40px; height: 40px; border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem; margin-bottom: 12px;
}
.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: var(--success-light); color: var(--success); }
.stat-icon.warning { background: var(--warning-light); color: var(--warning); }
.stat-icon.danger { background: var(--danger-light); color: var(--danger); }
.stat-icon.info { background: var(--info-light); color: var(--info); }

.stat-value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat-label { font-size: 0.8rem; color: var(--text-light); margin-top: 2px; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }

table th {
    background: var(--bg); color: var(--text-light);
    font-weight: 600; font-size: 0.72rem;
    text-transform: uppercase; letter-spacing: 0.05em;
    padding: 10px 14px; text-align: left; border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

table td {
    padding: 10px 14px; border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

table tbody tr:hover { background: #f8fafc; }
table tbody tr:last-child td { border-bottom: none; }

table input[type="text"],
table input[type="email"],
table textarea,
table select {
    width: 100%; padding: 6px 8px; font-size: 0.8rem;
    border: 1px solid var(--border); border-radius: 4px;
    font-family: inherit; background: #fff;
    transition: border-color 0.15s;
}
table input:focus, table textarea:focus, table select:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.1);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; font-size: 0.825rem; font-weight: 500;
    font-family: inherit; border: 1px solid transparent;
    border-radius: 6px; cursor: pointer; transition: all 0.15s;
    white-space: nowrap; line-height: 1.4;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn i { font-size: 0.8rem; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }

.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn-warning { background: var(--warning); color: #fff; }
.btn-warning:hover { background: #d97706; }

.btn-outline {
    background: transparent; color: var(--text); border-color: var(--border);
}
.btn-outline:hover { background: var(--bg); border-color: #cbd5e1; }

.btn-ghost { background: transparent; color: var(--text-light); border: none; padding: 6px 10px; }
.btn-ghost:hover { color: var(--text); background: var(--bg); }

.btn-sm { padding: 5px 12px; font-size: 0.78rem; }

.btn-group { display: flex; gap: 8px; }

/* ===== FORMS ===== */
.form-group { margin-bottom: 16px; }

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

.form-control {
    width: 100%; padding: 9px 12px; font-size: 0.85rem;
    font-family: inherit; color: var(--text);
    background: #fff; border: 1px solid var(--border);
    border-radius: 6px; transition: all 0.15s;
}
.form-control:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-control::placeholder { color: #94a3b8; }

select.form-control {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8.825a.7.7 0 0 1-.5-.2L2.05 5.175a.7.7 0 1 1 .99-.99L6 7.145l2.96-2.96a.7.7 0 1 1 .99.99L6.5 8.625a.7.7 0 0 1-.5.2Z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 32px;
}

textarea.form-control { resize: vertical; min-height: 70px; }

.form-inline { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }
.form-inline .form-group { margin-bottom: 0; }

.form-check { display: flex; align-items: center; gap: 8px; }
.form-check input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--primary); }

/* ===== FLASH ===== */
.flash {
    padding: 12px 18px; border-radius: 6px;
    font-size: 0.85rem; font-weight: 500; margin-bottom: 16px;
    display: flex; align-items: center; gap: 10px;
}
.flash-success { background: var(--success-light); color: #065f46; border: 1px solid #a7f3d0; }
.flash-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.flash-warning { background: var(--warning-light); color: #92400e; border: 1px solid #fcd34d; }
.flash-info { background: var(--info-light); color: #1e40af; border: 1px solid #93c5fd; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex; padding: 2px 10px;
    font-size: 0.7rem; font-weight: 600; border-radius: 9999px;
}
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }

/* ===== TOOLBAR (rich editor) ===== */
.toolbar {
    display: flex; flex-wrap: wrap; gap: 4px;
    padding: 10px 12px; background: #f8fafc;
    border: 1px solid var(--border); border-bottom: none;
    border-radius: var(--radius) var(--radius) 0 0;
}
.toolbar button, .toolbar select {
    padding: 6px 10px; border: 1px solid var(--border);
    background: #fff; border-radius: 4px; cursor: pointer;
    font-size: 0.8rem; color: var(--text); transition: all 0.15s;
    font-family: inherit;
}
.toolbar button:hover { background: var(--primary-light); border-color: var(--primary); }
.toolbar button i { pointer-events: none; }

.editor-container {
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius) var(--radius);
    padding: 16px; min-height: 160px;
    background: #fff; font-size: 0.9rem;
    line-height: 1.7; outline: none;
}
.editor-container:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79,70,229,0.1); }

/* ===== NEWS ITEMS ===== */
.news-item {
    background: var(--bg-card); padding: 18px;
    border-radius: var(--radius); border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.news-item + .news-item { margin-top: 12px; }
.news-content { margin-bottom: 8px; line-height: 1.6; font-size: 0.9rem; }
.news-meta { font-size: 0.75rem; color: var(--text-light); margin-bottom: 10px; }

/* ===== QUESTION DU JOUR ===== */
.quiz-card {
    background: linear-gradient(135deg, #eef2ff 0%, #e0e7ff 100%);
    border: 1px solid #c7d2fe; border-radius: var(--radius-lg);
    padding: 28px; text-align: center;
}
.quiz-card h3 { color: var(--primary); margin-bottom: 8px; }
.quiz-options label {
    display: block; padding: 10px 16px; margin: 6px 0;
    background: #fff; border: 1px solid var(--border);
    border-radius: 6px; cursor: pointer; transition: all 0.15s;
    text-align: left; font-size: 0.875rem;
}
.quiz-options label:hover { border-color: var(--primary); background: #f5f3ff; }
.quiz-options input[type="checkbox"] { margin-right: 8px; accent-color: var(--primary); }

/* ===== GRID & UTILITIES ===== */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }
.grid-70-30 { grid-template-columns: 7fr 3fr; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.text-sm { font-size: 0.8rem; }
.text-light { color: var(--text-light); }
.text-center { text-align: center; }

.empty-state { text-align: center; padding: 48px 24px; color: var(--text-light); }
.empty-state i { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.3; display: block; }

/* ===== PAGINATION ===== */
.pagination {
    display: flex; gap: 4px; justify-content: center;
    margin-top: 20px; flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 36px; height: 36px; padding: 0 10px;
    border: 1px solid var(--border); border-radius: 6px;
    font-size: 0.8rem; font-weight: 500; color: var(--text);
    background: #fff; transition: all 0.15s;
}
.pagination a:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { opacity: 0.4; pointer-events: none; }

/* ===== SPINNER ===== */
.spinner {
    width: 20px; height: 20px;
    border: 2px solid var(--border); border-top-color: var(--primary);
    border-radius: 50%; animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    :root { --sidebar-w: 0px; }
    .sidebar { transform: translateX(-260px); }
    main { margin-left: 0; padding: 16px; }
    .grid-2, .grid-3, .grid-70-30 { grid-template-columns: 1fr; }
}
