/* assets/css/style.css */

/* ===============================
   Style général
================================ */
html, body {
    width: 100%;
    min-height: 100%;
}

body {
    margin: 0;
    font-family: Arial, sans-serif;
}

/* La page login garde le centrage */
body:not(.dashboard-body) {
    min-height: 100vh;
    background: linear-gradient(135deg, #7f1d1d, #1e3a8a);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ===============================
   Carte de connexion
================================ */
.login-card {
    width: 100%;
    max-width: 430px;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.25);
    padding: 35px;
}

/* ===============================
   Logo
================================ */
.login-logo {
    width: 95px;
    height: 95px;
    object-fit: contain;
    border-radius: 50%;
    background: #ffffff;
    padding: 6px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}

/* ===============================
   Titres
================================ */
.app-title {
    font-weight: 800;
    color: #7f1d1d;
    text-align: center;
    margin-bottom: 5px;
}

.app-subtitle {
    text-align: center;
    color: #555;
    font-size: 14px;
    margin-bottom: 25px;
}

/* ===============================
   Bouton de connexion
================================ */
.btn-login {
    background: #7f1d1d;
    border: none;
    font-weight: bold;
}

.btn-login:hover {
    background: #991b1b;
}

/* ===============================
   Badge sécurité
================================ */
.badge-secure {
    background: #e0f2fe;
    color: #075985;
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    display: inline-block;
    margin-bottom: 15px;
}

/* ===============================
   Note de confidentialité
================================ */
.security-note {
    font-size: 12px;
    color: #666;
    text-align: center;
    margin-top: 15px;
}
/* ===============================
   Dashboard
================================ */

.dashboard-body {
    min-height: 100vh;
    background: #f3f4f6;
    font-family: Arial, sans-serif;
    max-width: 100%;
}

/* Sidebar */
.sidebar {
    width: 260px;
    min-height: 100vh;
    background: #7f1d1d;
    color: #ffffff;
    padding: 22px 18px;
    position: fixed;
    left: 0;
    top: 0;
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
}

.sidebar-logo {
    width: 75px;
    height: 75px;
    object-fit: contain;
    border-radius: 50%;
    background: #ffffff;
    padding: 5px;
    margin-bottom: 10px;
}

.sidebar-header h5 {
    font-weight: 700;
    margin-bottom: 3px;
}

.sidebar-header small {
    color: #fecaca;
}

.sidebar-menu a {
    display: block;
    color: #fee2e2;
    text-decoration: none;
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 6px;
    font-size: 15px;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: #991b1b;
    color: #ffffff;
}

.sidebar-menu .logout-link {
    margin-top: 20px;
    background: #ffffff;
    color: #7f1d1d;
    font-weight: bold;
}

.sidebar-menu .logout-link:hover {
    background: #fee2e2;
    color: #7f1d1d;
}

/* Main content */
/* Main content */
.main-content {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-height: 100vh;
    padding: 24px 35px;
    background: #f3f4f6;
}

/* Conteneur large pour les dashboards */
.dashboard-container,
.content-wrapper {
    width: 100%;
    max-width: 100%;
    margin: 0;
}

/* Filtres du dashboard */
.filter-card {
    width: 100%;
}

/* Grille des statistiques */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(220px, 1fr));
    gap: 18px;
    margin: 24px 0;
}

/* Grille des graphiques */
.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1.4fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Cartes graphiques */
.chart-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

/* Hauteur contrôlée des graphiques */
.chart-box {
    position: relative;
    height: 360px;
}

.topbar {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.topbar h3 {
    margin: 0;
    font-weight: 800;
    color: #111827;
}

.topbar p {
    margin: 5px 0 0;
    color: #6b7280;
}

.user-info {
    text-align: right;
    color: #374151;
}

.user-info span {
    color: #7f1d1d;
    font-size: 14px;
}

/* Stat cards */
.stat-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    border-left: 5px solid #1e3a8a;
}

.stat-card.warning {
    border-left-color: #f59e0b;
}

.stat-card.danger {
    border-left-color: #dc2626;
}

.stat-label {
    color: #6b7280;
    font-size: 14px;
}

.stat-card h2 {
    margin: 8px 0;
    font-weight: 800;
    color: #111827;
}

.stat-card p {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

/* Content cards */
.content-card {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.content-card h5 {
    font-weight: 700;
    color: #111827;
}

.empty-chart {
    height: 260px;
    border: 2px dashed #d1d5db;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    background: #f9fafb;
}

.quick-actions a {
    display: block;
    text-decoration: none;
    background: #f3f4f6;
    color: #111827;
    padding: 13px 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    font-weight: 600;
}

.quick-actions a:hover {
    background: #fee2e2;
    color: #7f1d1d;
}

/* Responsive */
/* Responsive */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .sidebar {
        position: relative;
        width: 100%;
        min-height: auto;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 20px;
    }

    .d-flex {
        display: block !important;
    }

    .topbar {
        display: block;
    }

    .user-info {
        text-align: left;
        margin-top: 15px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================================================
   Améliorations responsive mobile/tablette
   À partir de cette section, l'application devient plus
   confortable sur téléphone et tablette.
========================================================= */

body.dashboard-body {
    display: block;
    align-items: initial;
    justify-content: initial;
    overflow-x: hidden;
}

/* Bouton hamburger mobile */
.mobile-menu-toggle {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1100;
    border: 0;
    border-radius: 12px;
    background: #7f1d1d;
    color: #ffffff;
    width: 44px;
    height: 44px;
    font-size: 1.65rem;
    line-height: 1;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
}

.sidebar-overlay {
    display: none;
}

/* Les tableaux doivent rester lisibles sur mobile */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table {
    white-space: nowrap;
}

/* Les champs ne doivent jamais dépasser l'écran */
input,
select,
textarea,
.form-control,
.form-select {
    max-width: 100%;
}

/* Cartes et graphiques fluides */
.content-card,
.dashboard-card,
.chart-card,
.stat-card {
    max-width: 100%;
}

canvas {
    max-width: 100% !important;
}

/* Tablette */
@media (max-width: 1199.98px) {
    .main-content {
        padding: 22px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(220px, 1fr));
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile + petite tablette */
@media (max-width: 991.98px) {
    body.dashboard-body > .d-flex {
        display: block !important;
        width: 100%;
    }

    .mobile-menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        position: fixed;
        left: -290px;
        top: 0;
        width: 280px;
        max-width: 86vw;
        height: 100vh;
        min-height: 100vh;
        z-index: 1090;
        overflow-y: auto;
        transition: left .25s ease;
        box-shadow: 12px 0 28px rgba(15, 23, 42, 0.25);
    }

    body.sidebar-open .sidebar {
        left: 0;
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1080;
    }

    body.sidebar-open .sidebar-overlay {
        display: block;
    }

    .main-content {
        margin-left: 0;
        width: 100%;
        min-height: 100vh;
        padding: 72px 16px 20px;
    }

    .topbar {
        display: block;
        padding: 18px;
        border-radius: 14px;
    }

    .topbar h3 {
        font-size: 1.25rem;
    }

    .topbar p {
        font-size: .92rem;
    }

    .user-info {
        text-align: left;
        margin-top: 12px;
    }

    .content-card {
        padding: 18px;
        border-radius: 14px;
    }

    .row.g-4,
    .row.g-3 {
        --bs-gutter-x: .85rem;
        --bs-gutter-y: .85rem;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .stat-card {
        min-height: auto;
    }

    .stat-value,
    .stat-card .stat-value {
        font-size: 1.45rem;
    }

    .chart-box {
        height: 280px;
    }

    .card-header {
        padding: 14px 16px;
    }

    .card-body {
        padding: 16px;
    }
}

/* Téléphone */
@media (max-width: 575.98px) {
    body:not(.dashboard-body) {
        padding: 14px;
        align-items: flex-start;
    }

    .login-card {
        margin-top: 18px;
        padding: 24px 18px;
        border-radius: 16px;
    }

    .login-logo {
        width: 78px;
        height: 78px;
    }

    .app-title {
        font-size: 1.35rem;
    }

    .app-subtitle {
        font-size: .9rem;
    }

    .main-content {
        padding: 68px 12px 16px;
    }

    .topbar {
        padding: 15px;
    }

    .topbar h3 {
        font-size: 1.12rem;
    }

    .content-card {
        padding: 15px;
    }

    h3 {
        font-size: 1.2rem;
    }

    h5 {
        font-size: 1rem;
    }

    .btn,
    .form-control,
    .form-select {
        font-size: .95rem;
    }

    .table {
        font-size: .86rem;
    }

    .badge {
        white-space: normal;
        text-align: left;
    }
}
.sidebar {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-menu {
    padding-bottom: 30px;
}

/* Scrollbar plus propre */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.35);
    border-radius: 10px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
