/* =========================================================================
   Chasse aux Risques — Dashboard Cyberpunk Theme
   ========================================================================= */

:root {
    --cyber-bg: #0a0a1a;
    --cyber-surface: #121228;
    --cyber-cyan: #00ffd5;
    --cyber-magenta: #ff00ff;
    --cyber-blue: #0066ff;
    --cyber-green: #00ff66;
    --cyber-text: #e0e0e0;
    --sidebar-width: 250px;
}

/* ========================= GLOBAL ========================= */

body {
    background-color: var(--cyber-bg);
    color: var(--cyber-text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

::selection {
    background: rgba(0, 255, 213, 0.3);
    color: #fff;
}

a {
    transition: color 0.2s ease, box-shadow 0.2s ease;
}

/* ========================= TEXT COLORS ========================= */

.text-cyber-cyan {
    color: var(--cyber-cyan) !important;
}

.text-cyber-magenta {
    color: var(--cyber-magenta) !important;
}

.text-cyber-green {
    color: var(--cyber-green) !important;
}

.text-cyber-blue {
    color: var(--cyber-blue) !important;
}

/* ========================= SIDEBAR ========================= */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--cyber-surface);
    border-right: 1px solid rgba(0, 255, 213, 0.3);
    z-index: 1000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(0, 255, 213, 0.15);
}

.sidebar-header h4 {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.sidebar-nav {
    list-style: none;
    padding: 1rem 0;
    margin: 0;
    flex: 1;
}

.sidebar-nav li {
    margin-bottom: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    color: var(--cyber-text);
    text-decoration: none;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    color: var(--cyber-cyan);
    background: rgba(0, 255, 213, 0.05);
    border-left-color: rgba(0, 255, 213, 0.3);
    text-decoration: none;
}

.sidebar-link.active {
    color: var(--cyber-cyan);
    background: rgba(0, 255, 213, 0.08);
    border-left-color: var(--cyber-cyan);
    font-weight: 600;
}

.sidebar-link i {
    font-size: 1.15rem;
    width: 1.5rem;
    text-align: center;
}

/* ========================= MAIN CONTENT ========================= */

.main-content {
    margin-left: var(--sidebar-width);
    padding: 0;
    min-height: 100vh;
}

/* ========================= TOPBAR ========================= */

.topbar {
    border-bottom: 1px solid rgba(0, 255, 213, 0.15);
    padding: 1rem 2rem;
    margin-bottom: 0;
    position: sticky;
    top: 0;
    background: var(--cyber-bg);
    z-index: 100;
}

.topbar h5 {
    font-weight: 600;
}

/* ========================= CONTENT WRAPPER ========================= */

.content-wrapper {
    padding: 1.5rem 2rem 2rem 2rem;
}

/* ========================= CARDS ========================= */

.card {
    background: var(--cyber-surface);
    border: 1px solid rgba(0, 255, 213, 0.15);
    border-radius: 12px;
    box-shadow: 0 0 15px rgba(0, 255, 213, 0.03);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.card:hover {
    box-shadow: 0 0 25px rgba(0, 255, 213, 0.06);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid rgba(0, 255, 213, 0.1);
    padding: 1rem 1.5rem;
}

.card-body {
    padding: 1.25rem 1.5rem;
}

/* ========================= STAT CARDS ========================= */

.stat-card {
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.stat-card .card-body {
    padding: 1.5rem 1rem;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 30px rgba(0, 255, 213, 0.1);
}

.stat-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 700;
    line-height: 1.2;
}

.stat-label {
    font-size: 0.8rem;
    color: rgba(224, 224, 224, 0.6);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 0.5rem;
}

/* ========================= SESSION ACTIVE CARD ========================= */

.session-active-card {
    border-left: 3px solid var(--cyber-green);
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.session-active-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(0, 255, 102, 0.1);
}

/* ========================= TABLES ========================= */

.table-dark {
    --bs-table-bg: transparent;
    --bs-table-color: var(--cyber-text);
    --bs-table-border-color: rgba(0, 255, 213, 0.08);
    --bs-table-striped-bg: rgba(0, 255, 213, 0.02);
    --bs-table-hover-bg: rgba(0, 255, 213, 0.05);
    --bs-table-hover-color: #fff;
    margin-bottom: 0;
}

.table-dark th,
.table-dark td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
}

.table-dark thead th {
    color: var(--cyber-cyan);
    font-weight: 600;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid rgba(0, 255, 213, 0.15);
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

.table-dark tbody tr {
    transition: background-color 0.15s ease;
}

/* Clickable rows */
.clickable-row:hover {
    cursor: pointer;
    background: rgba(0, 255, 213, 0.05) !important;
}

/* ========================= BUTTONS ========================= */

.btn-cyber {
    background: linear-gradient(135deg, var(--cyber-cyan), var(--cyber-blue));
    border: none;
    color: #000;
    font-weight: 600;
    padding: 0.5rem 1.25rem;
    transition: all 0.3s ease;
    border-radius: 6px;
}

.btn-cyber:hover {
    box-shadow: 0 0 20px rgba(0, 255, 213, 0.4);
    transform: translateY(-1px);
    color: #000;
}

.btn-cyber:active {
    transform: translateY(0);
}

.btn-outline-secondary {
    border-color: rgba(224, 224, 224, 0.3);
    color: var(--cyber-text);
}

.btn-outline-secondary:hover {
    background: rgba(224, 224, 224, 0.1);
    border-color: rgba(224, 224, 224, 0.5);
    color: #fff;
}

.btn-outline-info {
    border-color: var(--cyber-cyan);
    color: var(--cyber-cyan);
}

.btn-outline-info:hover {
    background: rgba(0, 255, 213, 0.15);
    border-color: var(--cyber-cyan);
    color: var(--cyber-cyan);
    box-shadow: 0 0 10px rgba(0, 255, 213, 0.2);
}

.btn-outline-danger:hover {
    box-shadow: 0 0 10px rgba(255, 0, 0, 0.2);
}

/* ========================= FORMS ========================= */

.form-control,
.form-select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 213, 0.15);
    color: var(--cyber-text);
    padding: 0.6rem 0.85rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-control:focus,
.form-select:focus {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--cyber-cyan);
    box-shadow: 0 0 0 0.2rem rgba(0, 255, 213, 0.15);
    color: #fff;
}

.form-control::placeholder {
    color: rgba(224, 224, 224, 0.35);
}

.form-label {
    color: rgba(224, 224, 224, 0.8);
    font-size: 0.9rem;
    font-weight: 500;
}

.form-check-input {
    background-color: rgba(0, 0, 0, 0.3);
    border-color: rgba(0, 255, 213, 0.3);
}

.form-check-input:checked {
    background-color: var(--cyber-cyan);
    border-color: var(--cyber-cyan);
}

.form-check-label {
    color: var(--cyber-text);
}

/* ========================= ALERTS ========================= */

.alert {
    border-radius: 8px;
    border: 1px solid;
}

.alert-success {
    background: rgba(0, 255, 102, 0.1);
    border-color: rgba(0, 255, 102, 0.3);
    color: var(--cyber-green);
}

.alert-danger {
    background: rgba(255, 0, 0, 0.1);
    border-color: rgba(255, 0, 0, 0.3);
    color: #ff6666;
}

/* ========================= PROGRESS BAR ========================= */

.progress {
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar {
    transition: width 0.6s ease;
    border-radius: 5px;
}

/* ========================= BADGES ========================= */

.badge {
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 0.4em 0.7em;
}

/* ========================= ROLE BADGES ========================= */

.badge-role-admin {
    background: rgba(255, 0, 255, 0.15);
    border: 1px solid var(--cyber-magenta);
    color: var(--cyber-magenta);
}

.badge-role-formateur {
    background: rgba(0, 255, 213, 0.15);
    border: 1px solid var(--cyber-cyan);
    color: var(--cyber-cyan);
}

/* ========================= CODE / PRE ========================= */

code {
    color: var(--cyber-cyan);
    font-size: 0.85em;
}

pre {
    font-family: 'Consolas', 'Courier New', monospace;
}

/* ========================= MODAL ========================= */

.modal-content {
    background: var(--cyber-surface);
    border: 1px solid rgba(0, 255, 213, 0.2);
    border-radius: 12px;
}

.modal-header {
    border-bottom: 1px solid rgba(0, 255, 213, 0.15);
    padding: 1.25rem 1.5rem;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    border-top: 1px solid rgba(0, 255, 213, 0.15);
    padding: 1.25rem 0 0 0;
    margin-top: 0.5rem;
}

/* ========================= DATATABLES OVERRIDES ========================= */

div.dataTables_wrapper .dataTables_length,
div.dataTables_wrapper .dataTables_filter,
div.dataTables_wrapper .dataTables_info,
div.dataTables_wrapper .dataTables_processing,
div.dataTables_wrapper .dataTables_paginate {
    color: var(--cyber-text) !important;
}

div.dataTables_wrapper .dataTables_filter input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 213, 0.15);
    color: var(--cyber-text);
    border-radius: 4px;
    padding: 0.3rem 0.6rem;
}

div.dataTables_wrapper .dataTables_filter input:focus {
    border-color: var(--cyber-cyan);
    outline: none;
    box-shadow: 0 0 0 0.15rem rgba(0, 255, 213, 0.15);
}

div.dataTables_wrapper .dataTables_length select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(0, 255, 213, 0.15);
    color: var(--cyber-text);
    border-radius: 4px;
    padding: 0.2rem 0.5rem;
}

.page-item .page-link {
    background: transparent;
    border-color: rgba(0, 255, 213, 0.15);
    color: var(--cyber-text);
}

.page-item.active .page-link {
    background: var(--cyber-cyan);
    border-color: var(--cyber-cyan);
    color: #000;
}

.page-item .page-link:hover {
    background: rgba(0, 255, 213, 0.1);
    border-color: var(--cyber-cyan);
    color: var(--cyber-cyan);
}

.page-item.disabled .page-link {
    background: transparent;
    border-color: rgba(0, 255, 213, 0.05);
    color: rgba(224, 224, 224, 0.3);
}

/* ========================= CHART.JS CANVAS ========================= */

canvas {
    max-width: 100%;
}

/* ========================= SCROLLBAR ========================= */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--cyber-bg);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 213, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 255, 213, 0.4);
}

/* ========================= GLOW EFFECTS ========================= */

.glow-cyan {
    box-shadow: 0 0 15px rgba(0, 255, 213, 0.3);
}

.glow-magenta {
    box-shadow: 0 0 15px rgba(255, 0, 255, 0.3);
}

/* Interactive glow on hover */
.card:hover .stat-icon {
    filter: drop-shadow(0 0 8px currentColor);
    transition: filter 0.3s ease;
}

/* ========================= RESPONSIVE ========================= */

@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        height: auto;
        position: relative;
        border-right: none;
        border-bottom: 1px solid rgba(0, 255, 213, 0.3);
    }

    .sidebar-nav {
        display: flex;
        flex-wrap: wrap;
        padding: 0.5rem;
        gap: 0;
    }

    .sidebar-nav li {
        margin-bottom: 0;
    }

    .sidebar-link {
        padding: 0.5rem 0.75rem;
        border-left: none;
        border-bottom: 3px solid transparent;
        font-size: 0.85rem;
    }

    .sidebar-link.active {
        border-left: none;
        border-bottom-color: var(--cyber-cyan);
    }

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

    .topbar {
        padding: 0.75rem 1rem;
    }

    .content-wrapper {
        padding: 1rem;
    }

    .stat-value {
        font-size: 1.5rem;
    }

    .card-header {
        padding: 0.85rem 1rem;
    }

    .card-body {
        padding: 1rem;
    }
}
