:root {
    --primary: #003366;
    --primary-light: #004a99;
    --primary-dark: #002244;
    --accent: #F39200;
    --accent-light: #f5a623;
    --accent-dark: #d47e00;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --light: #f8f9fa;
    --dark: #343a40;
    --gray: #6c757d;
    --white: #ffffff;
    --sidebar-width: 260px;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--light);
    color: #333;
    min-height: 100vh;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 50%, #001a33 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: rgba(243, 146, 0, 0.1);
    border-radius: 50%;
    top: -100px;
    right: -100px;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: rgba(243, 146, 0, 0.08);
    border-radius: 50%;
    bottom: -80px;
    left: -80px;
}

.login-card {
    background: var(--white);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    z-index: 1;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo img {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
}

.login-logo h1 {
    font-size: 1.3rem;
    color: var(--primary);
    font-weight: 700;
    line-height: 1.4;
}

.login-logo p {
    color: var(--gray);
    font-size: 0.9rem;
    margin-top: 5px;
}

.form-floating {
    margin-bottom: 16px;
}

.form-floating .form-control {
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    padding: 12px 16px;
    font-size: 0.95rem;
    transition: border-color 0.3s;
}

.form-floating .form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(243, 146, 0, 0.15);
}

.btn-login {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border: none;
    border-radius: 10px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--white);
    width: 100%;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-login:hover {
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(243, 146, 0, 0.3);
    color: var(--white);
}

.alert-login {
    border-radius: 10px;
    font-size: 0.9rem;
}

/* ========== SIDEBAR ========== */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    z-index: 1000;
    transition: all 0.3s;
    overflow-y: auto;
}

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

.sidebar-header img {
    width: 50px;
    height: 50px;
    object-fit: contain;
    margin-bottom: 10px;
}

.sidebar-header h3 {
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 600;
    line-height: 1.4;
}

.sidebar-menu {
    list-style: none;
    padding: 15px 0;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.3s;
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
    border-left-color: var(--accent);
}

.sidebar-menu li a i {
    width: 22px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1rem;
}

.sidebar-menu li a.active {
    background: rgba(243, 146, 0, 0.15);
    color: var(--accent);
    font-weight: 600;
}

/* ========== MAIN CONTENT ========== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.topbar {
    background: var(--white);
    padding: 15px 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 999;
}

.topbar h4 {
    font-size: 1.1rem;
    color: var(--primary);
    font-weight: 600;
}

.topbar .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray);
    font-size: 0.9rem;
}

.topbar .user-info i {
    color: var(--accent);
}

.content-area {
    padding: 25px 30px;
}

/* ========== KPI CARDS ========== */
.kpi-card {
    background: var(--white);
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--accent);
    transition: transform 0.3s, box-shadow 0.3s;
}

.kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.kpi-card .kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--white);
    margin-bottom: 12px;
}

.kpi-card .kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--primary);
}

.kpi-card .kpi-label {
    font-size: 0.8rem;
    color: var(--gray);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.bg-kpi-1 { background: var(--accent); }
.bg-kpi-2 { background: var(--primary); }
.bg-kpi-3 { background: var(--success); }
.bg-kpi-4 { background: var(--info); }
.bg-kpi-5 { background: var(--danger); }
.bg-kpi-6 { background: var(--warning); }

/* ========== TABLES ========== */
.card-custom {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
    border: none;
    overflow: hidden;
}

.card-custom .card-header {
    background: var(--primary);
    color: var(--white);
    padding: 15px 20px;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
}

.card-custom .card-header i {
    color: var(--accent);
    margin-right: 8px;
}

.table-custom {
    margin: 0;
}

.table-custom thead th {
    background: var(--primary);
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 15px;
    border: none;
    white-space: nowrap;
}

.table-custom tbody td {
    padding: 10px 15px;
    font-size: 0.9rem;
    vertical-align: middle;
    border-bottom: 1px solid #eee;
}

.table-custom tbody tr:hover {
    background: rgba(243, 146, 0, 0.05);
}

/* ========== BUTTONS ========== */
.btn-primary-custom {
    background: var(--primary);
    border: none;
    color: var(--white);
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-primary-custom:hover {
    background: var(--primary-light);
    color: var(--white);
    transform: translateY(-1px);
}

.btn-accent {
    background: var(--accent);
    border: none;
    color: var(--white);
    border-radius: 8px;
    padding: 8px 18px;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s;
}

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

.btn-action {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 0.85rem;
    transition: all 0.3s;
    padding: 0;
}

.btn-edit { background: rgba(0, 51, 102, 0.1); color: var(--primary); }
.btn-edit:hover { background: var(--primary); color: var(--white); }
.btn-delete { background: rgba(220, 53, 69, 0.1); color: var(--danger); }
.btn-delete:hover { background: var(--danger); color: var(--white); }
.btn-deactivate { background: rgba(108, 117, 125, 0.12); color: #6c757d; }
.btn-deactivate:hover { background: #6c757d; color: var(--white); }
.btn-activate { background: rgba(40, 167, 69, 0.12); color: #28a745; }
.btn-activate:hover { background: #28a745; color: var(--white); }

/* Ligne d'un migrant désactivé */
.row-inactif > td { opacity: 0.55; }
.row-inactif:hover > td { opacity: 1; }

/* ========== FORMS ========== */
.form-section {
    background: var(--white);
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 3px 15px rgba(0, 0, 0, 0.05);
    margin-bottom: 20px;
}

.form-section .form-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}

.form-section .form-control,
.form-section .form-select {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.9rem;
    transition: border-color 0.3s;
}

.form-section .form-control:focus,
.form-section .form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(243, 146, 0, 0.15);
}

/* ========== BADGES ========== */
.badge-sexe-m { background: rgba(0, 51, 102, 0.15); color: var(--primary); }
.badge-sexe-f { background: rgba(243, 146, 0, 0.15); color: var(--accent-dark); }

.badge-contact {
    font-size: 0.75rem;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 500;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.show { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .content-area { padding: 15px; }
    .topbar { padding: 10px 15px; }
}

/* ========== ANIMATIONS ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease-out; }

/* ========== PAGINATION ========== */
.pagination .page-link {
    color: var(--primary);
    border-radius: 8px;
    margin: 0 3px;
    border: none;
    font-size: 0.85rem;
}

.pagination .page-item.active .page-link {
    background: var(--accent);
    color: var(--white);
}

/* ========== SEARCH ========== */
.search-box {
    position: relative;
}

.search-box input {
    padding-left: 38px;
    border-radius: 20px;
    border: 2px solid #e0e0e0;
}

.search-box i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

.search-box input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(243, 146, 0, 0.15);
}
