@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* =====================================================
   RESET & VARIABLES
   ===================================================== */
:root {
    --primary: #1A5276;
    --primary-light: #2E86C1;
    --secondary: #2980B9;
    --success: #1E8449;
    --danger: #C0392B;
    --warning: #D68910;
    --info: #2E86C1;
    --bg-main: #F4F6F9;
    --bg-sidebar: #0E2F44;
    --text-primary: #2C3E50;
    --text-secondary: #7F8C8D;
    --white: #FFFFFF;
    --brown: #6E3B1A;
    --border: #E0E4E8;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.12);
    --radius: 8px;
    --radius-sm: 4px;
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --header-height: 60px;
    --transition: all 0.3s ease;
    --font: 'Inter', 'Segoe UI', -apple-system, sans-serif;
}

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

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font);
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--secondary);
    text-decoration: none;
    transition: var(--transition);
}

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

img {
    max-width: 100%;
}

/* =====================================================
   LAYOUT
   ===================================================== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: var(--transition);
}

.main-content.sidebar-collapsed {
    margin-left: var(--sidebar-collapsed);
}

.content-area {
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
}

/* =====================================================
   SIDEBAR
   ===================================================== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--bg-sidebar);
    color: var(--white);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 1000;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

.sidebar-header {
    padding: 20px 16px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    flex-shrink: 0;
}

.sidebar-header .logo {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-bottom: 8px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.sidebar-header .site-name {
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.9);
}

.sidebar.collapsed .sidebar-header .site-name,
.sidebar.collapsed .nav-text,
.sidebar.collapsed .nav-section-title,
.sidebar.collapsed .nav-arrow {
    display: none;
}

.sidebar.collapsed .sidebar-header {
    padding: 16px 8px;
}

.sidebar.collapsed .sidebar-header .logo {
    width: 40px;
    height: 40px;
}

/* Navigation */
.sidebar-nav {
    flex: 1;
    padding: 8px 0;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.4);
    padding: 16px 20px 6px;
}

.nav-item {
    display: block;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    transition: var(--transition);
    border-left: 3px solid transparent;
    cursor: pointer;
    gap: 12px;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
}

.nav-link.active {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border-left-color: var(--primary-light);
}

.nav-link .nav-icon {
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    font-size: 1rem;
}

.nav-link .nav-text {
    flex: 1;
    white-space: nowrap;
}

.nav-link .nav-arrow {
    font-size: 0.7rem;
    transition: transform 0.3s;
}

.nav-link .nav-arrow.open {
    transform: rotate(90deg);
}

/* Sous-menu */
.nav-submenu {
    display: none;
    padding-left: 12px;
}

.nav-submenu.open {
    display: block;
}

.nav-submenu .nav-link {
    padding: 8px 20px 8px 44px;
    font-size: 0.85rem;
}

.sidebar.collapsed .nav-submenu {
    display: none !important;
}

.sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 12px 8px;
}

/* Sidebar footer */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0;
    flex-shrink: 0;
}

/* =====================================================
   HEADER
   ===================================================== */
.header {
    position: sticky;
    top: 0;
    background: var(--white);
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
    z-index: 500;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sidebar-toggle {
    background: none;
    border: none;
    font-size: 1.3rem;
    color: var(--text-primary);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}

.sidebar-toggle:hover {
    background: var(--bg-main);
}

/* Breadcrumb */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.breadcrumb a {
    color: var(--text-secondary);
}

.breadcrumb a:hover {
    color: var(--primary);
}

.breadcrumb .separator {
    color: var(--border);
}

.breadcrumb .current {
    color: var(--text-primary);
    font-weight: 500;
}

/* Header right */
.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.header-search {
    position: relative;
}

.header-search input {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 6px 16px 6px 36px;
    font-size: 0.85rem;
    width: 220px;
    transition: var(--transition);
    font-family: var(--font);
    outline: none;
}

.header-search input:focus {
    border-color: var(--primary-light);
    width: 280px;
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.1);
}

.header-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* Notifications bell */
.notification-bell {
    position: relative;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
}

.notification-bell:hover {
    background: var(--bg-main);
}

.notification-badge {
    position: absolute;
    top: 0;
    right: 0;
    background: var(--danger);
    color: var(--white);
    font-size: 0.65rem;
    font-weight: 700;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* Notifications dropdown */
.notification-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 360px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    z-index: 1100;
    max-height: 400px;
    overflow-y: auto;
}

.notification-dropdown.show {
    display: block;
}

.notification-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--bg-main);
    transition: var(--transition);
    display: flex;
    gap: 10px;
}

.notification-item:hover {
    background: var(--bg-main);
}

.notification-item.unread {
    background: rgba(46, 134, 193, 0.04);
}

.notification-item .notif-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
}

.notification-item .notif-icon.info { background: rgba(46, 134, 193, 0.15); color: var(--info); }
.notification-item .notif-icon.success { background: rgba(30, 132, 73, 0.15); color: var(--success); }
.notification-item .notif-icon.warning { background: rgba(214, 137, 16, 0.15); color: var(--warning); }
.notification-item .notif-icon.danger { background: rgba(192, 57, 43, 0.15); color: var(--danger); }

.notification-item .notif-content {
    flex: 1;
    min-width: 0;
}

.notification-item .notif-title {
    font-weight: 500;
    font-size: 0.85rem;
    margin-bottom: 2px;
}

.notification-item .notif-time {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* User dropdown */
.user-menu {
    position: relative;
}

.user-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    transition: var(--transition);
    background: none;
    border: none;
    font-family: var(--font);
    color: var(--text-primary);
}

.user-menu-trigger:hover {
    background: var(--bg-main);
}

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--primary);
    color: var(--white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.85rem;
}

.user-menu-trigger .user-name {
    font-size: 0.85rem;
    font-weight: 500;
}

.user-menu-trigger .user-role {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.user-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    width: 200px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    display: none;
    z-index: 1100;
    margin-top: 4px;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: var(--text-primary);
    font-size: 0.85rem;
    transition: var(--transition);
}

.user-dropdown a:hover {
    background: var(--bg-main);
}

.user-dropdown .divider {
    border-top: 1px solid var(--border);
    margin: 4px 0;
}

.user-dropdown a.text-danger {
    color: var(--danger);
}

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

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Stat cards */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.stat-card .stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
    flex-shrink: 0;
}

.stat-card .stat-icon.primary { background: rgba(26, 82, 118, 0.12); color: var(--primary); }
.stat-card .stat-icon.success { background: rgba(30, 132, 73, 0.12); color: var(--success); }
.stat-card .stat-icon.warning { background: rgba(214, 137, 16, 0.12); color: var(--warning); }
.stat-card .stat-icon.danger { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.stat-card .stat-icon.info { background: rgba(46, 134, 193, 0.12); color: var(--info); }

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =====================================================
   BADGES
   ===================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-primary { background: rgba(26, 82, 118, 0.12); color: var(--primary); }
.badge-success { background: rgba(30, 132, 73, 0.12); color: var(--success); }
.badge-warning { background: rgba(214, 137, 16, 0.12); color: var(--warning); }
.badge-danger { background: rgba(192, 57, 43, 0.12); color: var(--danger); }
.badge-info { background: rgba(46, 134, 193, 0.12); color: var(--info); }
.badge-secondary { background: rgba(127, 140, 141, 0.12); color: var(--text-secondary); }

/* =====================================================
   BUTTONS
   ===================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    line-height: 1.5;
    white-space: nowrap;
}

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

.btn-lg {
    padding: 12px 24px;
    font-size: 1rem;
}

.btn-primary {
    background: var(--primary);
    color: var(--white);
}
.btn-primary:hover {
    background: var(--primary-light);
    color: var(--white);
}

.btn-success {
    background: var(--success);
    color: var(--white);
}
.btn-success:hover {
    background: #27ae60;
    color: var(--white);
}

.btn-danger {
    background: var(--danger);
    color: var(--white);
}
.btn-danger:hover {
    background: #e74c3c;
    color: var(--white);
}

.btn-warning {
    background: var(--warning);
    color: var(--white);
}
.btn-warning:hover {
    background: #e67e22;
    color: var(--white);
}

.btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--primary);
}
.btn-outline:hover {
    background: var(--primary);
    color: var(--white);
}

.btn-secondary {
    background: var(--bg-main);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background: var(--border);
}

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

/* =====================================================
   TABLES
   ===================================================== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius);
}

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

.table-styled thead th {
    background: var(--primary);
    color: var(--white);
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.table-styled thead th:first-child {
    border-radius: var(--radius) 0 0 0;
}

.table-styled thead th:last-child {
    border-radius: 0 var(--radius) 0 0;
}

.table-styled tbody td {
    padding: 10px 16px;
    border-bottom: 1px solid var(--bg-main);
    vertical-align: middle;
}

.table-styled tbody tr:nth-child(even) {
    background: rgba(244, 246, 249, 0.5);
}

.table-styled tbody tr:hover {
    background: rgba(46, 134, 193, 0.04);
}

.table-styled .actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.table-styled .text-right {
    text-align: right;
}

.table-styled .text-center {
    text-align: center;
}

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

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--danger);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    color: var(--text-primary);
    background-color: var(--white);
    transition: var(--transition);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.1);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

select.form-control {
    -webkit-appearance: none;
    -moz-appearance: none;
    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='%237F8C8D' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 12px;
    padding-right: 36px;
}

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

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-inline {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.form-inline .form-group {
    margin-bottom: 0;
}

/* Filters bar */
.filters-bar {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.filters-bar .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

/* =====================================================
   ALERTS
   ===================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    gap: 12px;
}

.alert-success { background: rgba(30, 132, 73, 0.1); color: var(--success); border-left: 4px solid var(--success); }
.alert-danger { background: rgba(192, 57, 43, 0.1); color: var(--danger); border-left: 4px solid var(--danger); }
.alert-warning { background: rgba(214, 137, 16, 0.1); color: var(--warning); border-left: 4px solid var(--warning); }
.alert-info { background: rgba(46, 134, 193, 0.1); color: var(--info); border-left: 4px solid var(--info); }

.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.6;
    padding: 0;
    line-height: 1;
}

.alert-close:hover {
    opacity: 1;
}

/* =====================================================
   MODAL
   ===================================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-overlay.show {
    display: flex;
}

/* Standalone modal (used as overlay directly with .active toggle) */
.modal[id^="modal-"] {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 0;
    box-shadow: none;
    overflow-y: hidden;
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal[id^="modal-"].active {
    display: flex;
}

.modal[id^="modal-"] > .modal-content {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px;
    line-height: 1;
}

.modal-close:hover {
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border);
}

/* =====================================================
   PAGINATION
   ===================================================== */
.pagination {
    display: flex;
    gap: 4px;
    align-items: center;
    justify-content: center;
    margin-top: 24px;
}

.page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 8px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    background: var(--white);
    border: 1px solid var(--border);
    transition: var(--transition);
}

.page-link:hover {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.page-link.active {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

.page-dots {
    padding: 0 6px;
    color: var(--text-secondary);
}

/* =====================================================
   CITIZEN SEARCH DROPDOWN
   ===================================================== */
.citizen-dropdown {
    position: absolute; top: 100%; left: 0; right: 0; z-index: 1000;
    background: var(--white); border: 1px solid var(--border); border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15); max-height: 280px; overflow-y: auto; display: none;
}
.citizen-item {
    padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--border); transition: background 0.15s;
}
.citizen-item:last-child { border-bottom: none; }
.citizen-item:hover { background: var(--bg-light); }
.citizen-item-empty {
    padding: 14px; text-align: center; color: var(--text-secondary); font-size: 13px;
}
.citizen-selected-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.3);
    border-radius: 8px; padding: 8px 14px; font-size: 14px; color: var(--text-primary);
}
.citizen-selected-badge i { color: #22c55e; }
.btn-clear-citizen {
    background: none; border: none; color: var(--text-secondary); font-size: 18px;
    cursor: pointer; padding: 0 4px; line-height: 1;
}
.btn-clear-citizen:hover { color: var(--danger); }

[data-theme="dark"] .citizen-dropdown {
    background: #1e293b; border-color: #334155;
}
[data-theme="dark"] .citizen-item:hover { background: #334155; }
[data-theme="dark"] .citizen-selected-badge {
    background: rgba(59,130,246,0.15); border-color: rgba(59,130,246,0.4);
}

/* =====================================================
   TIMELINE
   ===================================================== */
.timeline {
    position: relative;
    padding-left: 28px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary-light);
    border: 2px solid var(--white);
    box-shadow: 0 0 0 2px var(--border);
}

.timeline-item .timeline-date {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.timeline-item .timeline-content {
    font-size: 0.9rem;
}

/* =====================================================
   TABS
   ===================================================== */
.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 20px;
    gap: 0;
}

.tab-link {
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: var(--transition);
    background: none;
    border-top: none;
    border-left: none;
    border-right: none;
    font-family: var(--font);
}

.tab-link:hover {
    color: var(--primary);
}

.tab-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* =====================================================
   PAGE HEADER
   ===================================================== */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header .page-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =====================================================
   SEARCH BAR
   ===================================================== */
.search-bar {
    position: relative;
    margin-bottom: 16px;
}

.search-bar input {
    width: 100%;
    padding: 10px 16px 10px 40px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: var(--font);
    outline: none;
    transition: var(--transition);
}

.search-bar input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(46, 134, 193, 0.1);
}

.search-bar .search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

/* =====================================================
   DROPDOWN
   ===================================================== */
.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    min-width: 180px;
    display: none;
    z-index: 1100;
    margin-top: 4px;
}

.dropdown-menu.show {
    display: block;
}

.dropdown-menu a,
.dropdown-menu button {
    display: block;
    width: 100%;
    padding: 8px 16px;
    font-size: 0.85rem;
    color: var(--text-primary);
    text-align: left;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    transition: var(--transition);
}

.dropdown-menu a:hover,
.dropdown-menu button:hover {
    background: var(--bg-main);
}

/* =====================================================
   UTILITIES
   ===================================================== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-muted { color: var(--text-secondary) !important; }
.text-primary { color: var(--primary) !important; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

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

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 20px;
}

.hidden {
    display: none !important;
}

/* =====================================================
   LOGIN PAGE
   ===================================================== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--primary) 100%);
    padding: 20px;
}

.login-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
}

.login-card .login-logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 16px;
    border: 3px solid var(--border);
}

.login-card h1 {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.login-card .login-subtitle {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-card .form-group {
    text-align: left;
}

.login-card .btn-primary {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    margin-top: 8px;
}

.login-error {
    background: rgba(192, 57, 43, 0.1);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

/* =====================================================
   SIDEBAR OVERLAY (mobile)
   ===================================================== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* =====================================================
   RESPONSIVE (Tablette)
   ===================================================== */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.mobile-open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0 !important;
    }

    .grid-2 {
        grid-template-columns: 1fr;
    }

    .grid-3 {
        grid-template-columns: 1fr;
    }

    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }

    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
}

/* Print styles */
@media print {
    .sidebar, .header, .filters-bar, .btn, .pagination {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
    }

    .content-area {
        padding: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* =====================================================
   DARK MODE
   ===================================================== */
[data-theme="dark"] {
    --bg-main: #0f1923;
    --bg-sidebar: #0a1219;
    --text-primary: #e0e6ed;
    --text-secondary: #8899a6;
    --white: #1a2736;
    --border: #253545;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.4);
    --primary: #2E86C1;
    --primary-light: #5DADE2;
    --secondary: #5DADE2;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #5DADE2;
}

[data-theme="dark"] .sidebar {
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
}

[data-theme="dark"] .header {
    background: var(--white);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .form-control {
    background-color: #1a2736;
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(93, 173, 226, 0.15);
}

[data-theme="dark"] select.form-control {
    background: #1a2736 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='%238899a6' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center / 12px;
    color: var(--text-primary);
}

[data-theme="dark"] select.form-control option {
    background: #1a2736;
    color: var(--text-primary);
}

[data-theme="dark"] .header-search input {
    background: #1a2736;
    color: var(--text-primary);
    border-color: var(--border);
}

[data-theme="dark"] .notification-dropdown,
[data-theme="dark"] .user-dropdown,
[data-theme="dark"] .dropdown-menu {
    background: #1a2736;
    border-color: var(--border);
}

[data-theme="dark"] .notification-item:hover,
[data-theme="dark"] .user-dropdown a:hover,
[data-theme="dark"] .dropdown-menu a:hover,
[data-theme="dark"] .dropdown-menu button:hover {
    background: #253545;
}

[data-theme="dark"] .table-styled tbody tr:nth-child(even) {
    background: rgba(26, 39, 54, 0.5);
}

[data-theme="dark"] .table-styled tbody tr:hover {
    background: rgba(46, 134, 193, 0.08);
}

[data-theme="dark"] .modal {
    background: #1a2736;
}

[data-theme="dark"] .modal[id^="modal-"] {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .modal[id^="modal-"] > .modal-content {
    background: #1a2736;
}

[data-theme="dark"] .modal-overlay {
    background: rgba(0, 0, 0, 0.7);
}

[data-theme="dark"] .login-page {
    background: linear-gradient(135deg, #0a1219 0%, #1a2736 100%);
}

[data-theme="dark"] .login-card {
    background: #1a2736;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .filters-bar {
    background: var(--white);
}

[data-theme="dark"] .timeline-item::before {
    border-color: #1a2736;
}

[data-theme="dark"] .page-link {
    background: var(--white);
    border-color: var(--border);
    color: var(--text-primary);
}

/* Dark mode toggle */
.dark-mode-toggle {
    background: none;
    border: none;
    font-size: 1.15rem;
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dark-mode-toggle:hover {
    background: var(--bg-main);
}
