/* Add this at the very top of style.css for robust box model */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Base HTML & Body styles */
html, body {
    height: 100%; /* Ensure html and body take full viewport height */
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif; /* Mettre la police ici pour éviter la redondance */
    background-color: var(--background-color);
    color: var(--text-color);
    overflow-x: hidden; /* Empêche le défilement horizontal */
}

/* Variables CSS pour les couleurs et autres propriétés réutilisables */
:root {
    --primary-color: #DAA520; /* Or (Gold) - Plus standard */
    --primary-color-dark: #B8860B; /* Or plus foncé pour contraste */
    --primary-color-light: #FFD700; /* Or plus clair pour survol/effets */
    --background-color: #0A0A0A; /* Noir très profond pour le fond général */
    --sidebar-background: #1C1C1C; /* Noir légèrement moins profond pour la sidebar */
    --card-background: #252525; /* Noir doux pour les cartes */
    --text-color: #E0E0E0; /* Gris clair pour le texte principal */
    --heading-color: var(--primary-color-light); /* Les titres en or clair */
    --subtle-border-color: #333333; /* Bordure plus discrète */
    --shadow-color: rgba(0, 0, 0, 0.6); /* Ombre plus prononcée */
    --active-link-gradient: linear-gradient(to right, var(--primary-color-dark), var(--primary-color-light)); /* Dégradé pour les liens actifs */
    --link-hover-color: #FFD700; /* Or clair pour le survol des liens */
    --button-bg-color: var(--primary-color);
    --button-hover-bg-color: var(--primary-color-light);
    --input-bg-color: #1C1C1C;
    --input-border-color: #555555;
    --danger-color: #dc3545; /* Rouge pour les erreurs/actions négatives */
    --success-color: #28a745; /* Vert pour les succès */
    --info-color: #17a2b8; /* Bleu pour les informations */
}

body {
    display: flex; /* Utilisation de flexbox pour le layout */
    min-height: 100vh; /* S'assure que le corps prend au moins toute la hauteur de la vue */
    /* overflow-x: hidden; est déjà sur html, body */
}

/* ========================================= */
/* Correction et Optimisation du Loader */
/* ========================================= */
#page-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999; /* S'assure qu'il est au-dessus de tout le reste */
    flex-direction: column;
    color: var(--primary-color-light);
    /* Utilisation de 'opacity' et 'visibility' pour une transition douce */
    opacity: 1;
    visibility: visible;
    transition: opacity 0.7s ease-out, visibility 0.7s ease-out;
}

/* La classe 'fade-out' remplacera 'hidden' */
#page-loader.fade-out { /* Renommé de 'hidden' pour correspondre au JS corrigé */
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Empêche les interactions une fois caché */
}

.loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-logo {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 20px;
    box-shadow: 0 0 30px var(--primary-color-light), 0 0 60px var(--primary-color);
    animation: pulseGlow 1.5s infinite alternate;
}

.loader-dots {
    display: flex;
    gap: 10px;
}

.dot {
    width: 15px;
    height: 15px;
    background-color: var(--primary-color);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dot:nth-child(1) { animation-delay: -0.32s; }
.dot:nth-child(2) { animation-delay: -0.16s; }
.dot:nth-child(3) { animation-delay: 0s; }

.loading-text {
    font-size: 1.2em;
    margin-top: 25px;
    font-weight: 500;
    letter-spacing: 1px;
    opacity: 0; /* Caché initialement pour une animation d'apparition */
    animation: fadeInText 1s forwards 0.8s; /* Apparition après les points */
}

/* Keyframes pour les animations du loader */
@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
        background-color: var(--primary-color-dark);
    }
    40% {
        transform: scale(1);
        background-color: var(--primary-color-light);
    }
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
    }
    100% {
        box-shadow: 0 0 40px rgba(255, 215, 0, 1), 0 0 10px rgba(255, 215, 0, 0.5);
    }
}

@keyframes fadeInText {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Empêche le défilement lorsque le loader est actif */
/* Renommée de 'loading' à 'no-scroll' pour correspondre au JS corrigé */
body.no-scroll {
    overflow: hidden;
    /* Ajout de height: 100% ou 100vh pour s'assurer que le contenu ne déborde pas pendant le chargement */
    height: 100vh;
}

/* ========================================= */
/* Styles du tableau de bord */
/* ========================================= */
.dashboard-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 250px;
    background-color: var(--sidebar-background);
    color: var(--text-color);
    padding: 20px;
    box-shadow: 2px 0 10px var(--shadow-color);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease-in-out;
    flex-shrink: 0; /* Empêche la sidebar de rétrécir */
}

.sidebar-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--subtle-border-color);
}

.sidebar-header .logo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
    border: 3px solid var(--primary-color);
}

.sidebar-header h1 {
    font-size: 1.5em;
    color: var(--heading-color);
    margin: 0;
}

.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav ul li {
    margin-bottom: 10px;
}

.sidebar-nav ul li a {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--text-color);
    text-decoration: none;
    border-radius: 8px;
    transition: background-color 0.3s ease, color 0.3s ease, transform 0.2s ease;
}

.sidebar-nav ul li a:hover {
    background-color: rgba(255, 215, 0, 0.1); /* Léger fond sur survol */
    color: var(--link-hover-color);
    transform: translateX(5px); /* Petit déplacement sur survol */
}

.sidebar-nav ul li a.active {
    background: var(--active-link-gradient);
    color: var(--background-color); /* Texte sombre sur fond clair */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    font-weight: bold;
}

.sidebar-nav ul li a i {
    margin-right: 10px;
    font-size: 1.1em;
}

/* Main Content */
.main-content {
    flex-grow: 1;
    padding: 20px;
    background-color: var(--background-color);
    transition: margin-left 0.3s ease-in-out;
}

/* Header principal */
.main-header {
    background-color: var(--card-background);
    padding: 15px 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.main-header h2 {
    margin: 0;
    color: var(--heading-color);
    font-size: 2em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-info span {
    color: var(--text-color);
    font-size: 1.1em;
}

.user-info i {
    color: var(--primary-color);
    font-size: 1.4em;
}

.menu-toggle {
    display: none; /* Caché par défaut sur les grands écrans */
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.8em;
    cursor: pointer;
    padding: 5px;
}

/* Styles des cartes du tableau de bord */
.dashboard-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 30px;
}

.card {
    background-color: var(--card-background);
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--shadow-color);
    text-align: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between; /* Aligne le contenu verticalement */
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 8px 16px var(--shadow-color);
}

.card h3 {
    color: var(--primary-color-light);
    font-size: 1.4em;
    margin-bottom: 10px;
}

.card p {
    font-size: 2.5em;
    color: var(--heading-color);
    font-weight: bold;
    margin: 10px 0;
    flex-grow: 1; /* Permet au paragraphe de prendre de l'espace */
    display: flex; /* Centrer le contenu si peu de texte */
    justify-content: center;
    align-items: center;
}

.card i {
    font-size: 3em;
    color: var(--primary-color);
    margin-top: 15px;
}

/* Style spécifique pour la carte du graphique */
.card.chart-card {
    grid-column: span 2; /* Prend 2 colonnes sur les grands écrans */
    /* Simplification des hauteurs, utilisez des min-height si la hauteur varie */
    height: 350px; /* Conserve une hauteur minimale et fixe pour le graphique */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 20px;
    overflow: hidden; /* Important pour éviter que le contenu ne déborde si le graphique est trop grand */
}

.card.chart-card canvas {
    max-width: 100%;
    height: 100% !important; /* Important pour que Chart.js respecte la hauteur du conteneur */
    width: 100% !important; /* S'assure que Chart.js s'adapte à la largeur du conteneur */
}

/* Section des marchands récents */
.recent-merchants {
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 4px 8px var(--shadow-color);
}

.recent-merchants h3 {
    color: var(--heading-color);
    font-size: 1.8em;
    margin-bottom: 20px;
    text-align: center;
}

.recent-merchants table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.recent-merchants th,
.recent-merchants td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--subtle-border-color);
    text-align: left;
    color: var(--text-color);
}

.recent-merchants th {
    background-color: var(--primary-color-dark);
    color: var(--heading-color);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

.recent-merchants tr:nth-child(even) {
    background-color: #2a2a2a; /* Légèrement plus foncé pour les lignes paires */
}

.recent-merchants tr:hover {
    background-color: #353535; /* Changement au survol */
}

.recent-merchants td:last-child {
    text-align: right;
}

/* Barre de recherche */
.search-container {
    position: relative;
    margin-bottom: 20px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.search-container input[type="text"] {
    width: 100%;
    padding: 12px 40px 12px 20px;
    border: 1px solid var(--input-border-color);
    border-radius: 25px;
    background-color: var(--input-bg-color);
    color: var(--text-color);
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.search-container input[type="text"]::placeholder {
    color: rgba(224, 224, 224, 0.7);
}

.search-container input[type="text"]:focus {
    border-color: var(--primary-color-light);
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.2);
}

.search-icon {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--primary-color);
    font-size: 1.2em;
}

/* --- Formulaires --- */
.form-container {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow-color);
    max-width: 600px;
    margin: 30px auto;
}

.form-container h2 {
    color: var(--heading-color);
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-color);
    font-weight: bold;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--input-border-color);
    border-radius: 8px;
    background-color: var(--input-bg-color);
    color: var(--text-color);
    font-size: 1em;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group input[type="email"]:focus,
.form-group input[type="password"]:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(218, 165, 32, 0.2);
}

textarea {
    resize: vertical; /* Permet le redimensionnement vertical */
    min-height: 80px;
}

.btn {
    display: inline-block;
    padding: 12px 25px;
    background-color: var(--button-bg-color);
    color: var(--background-color); /* Texte foncé sur bouton clair */
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: bold;
    text-decoration: none;
    text-align: center;
    transition: background-color 0.3s ease, transform 0.2s ease, box-shadow 0.3s ease;
}

.btn:hover {
    background-color: var(--button-hover-bg-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

/* Plus de généricité pour les classes de boutons */
.btn-primary {
    background-color: var(--primary-color);
    color: #fff; /* Force le blanc pour un meilleur contraste sur le doré */
}

.btn-primary:hover {
    background-color: var(--primary-color-dark);
}

.btn-danger {
    background-color: var(--danger-color);
    color: #fff;
}

.btn-danger:hover {
    background-color: #c82333;
}

/* Réutilisation des classes de messages pour cohérence */
.message-area {
    margin-top: 15px;
    padding: 10px;
    border-radius: 5px;
    text-align: center;
    font-weight: bold;
    /* Styles de base pour toutes les zones de message */
}

.message-area.success, .success-message { /* Combiné pour une meilleure cohérence */
    background-color: var(--success-color);
    color: white;
}

.message-area.error, .error-message { /* Combiné pour une meilleure cohérence */
    background-color: var(--danger-color);
    color: white;
}

/* Tableaux de gestion (comme manage_partners.php, manage_articles.php) */
.management-section {
    background-color: var(--card-background);
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow-color);
    margin-top: 30px;
}

.management-section h2 {
    color: var(--heading-color);
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
}

.management-table-container {
    overflow-x: auto; /* Permet le défilement sur les petits écrans */
    -webkit-overflow-scrolling: touch;
}

.management-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
    min-width: 700px; /* Assurez une largeur minimale pour les colonnes */
}

.management-table th, .management-table td {
    padding: 12px 15px;
    border-bottom: 1px solid var(--subtle-border-color);
    text-align: left;
    color: var(--text-color);
}

.management-table th {
    background-color: var(--primary-color-dark);
    color: var(--heading-color);
    font-weight: bold;
    text-transform: uppercase;
    font-size: 0.9em;
}

.management-table td {
    background-color: var(--card-background); /* Défini ici pour toutes les cellules */
}

.management-table tr:nth-child(even) td {
    background-color: #2a2a2a; /* Légèrement plus foncé pour les lignes paires */
}

.management-table tr:hover td {
    background-color: #353535; /* Changement au survol */
}

.management-table .actions {
    white-space: nowrap; /* Empêche les boutons de passer à la ligne */
}

.management-table .actions .btn {
    padding: 8px 12px;
    font-size: 0.85em;
    margin-right: 5px;
    border-radius: 5px;
}

/* Pagination (si utilisée) */
.pagination {
    display: flex;
    justify-content: center;
    margin-top: 30px;
    gap: 10px;
}

.pagination a, .pagination span {
    display: inline-block;
    padding: 10px 15px;
    border: 1px solid var(--subtle-border-color);
    border-radius: 5px;
    text-decoration: none;
    color: var(--text-color);
    background-color: var(--card-background);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.pagination a:hover {
    background-color: var(--primary-color);
    color: var(--background-color);
}

.pagination span.current {
    background-color: var(--primary-color-dark);
    color: white;
    font-weight: bold;
    border-color: var(--primary-color-dark);
}

/* Popup/Modal styles (pour les détails, modification, etc.) */
.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.popup-overlay.active {
    opacity: 1;
    visibility: visible;
}

.popup-content {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 25px var(--shadow-color);
    width: 90%;
    max-width: 700px;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    position: relative;
    max-height: 90vh; /* Limite la hauteur du contenu du popup */
    overflow-y: auto; /* Ajoute un défilement si le contenu dépasse */
}

.popup-overlay.active .popup-content {
    transform: translateY(0);
}

.popup-close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 2em;
    color: var(--text-color);
    cursor: pointer;
    transition: color 0.3s ease;
}

.popup-close:hover {
    color: var(--danger-color);
}

.popup-content h3 {
    color: var(--primary-color-light);
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
}

.popup-details p {
    margin-bottom: 10px;
    color: var(--text-color);
    font-size: 1.1em;
}

.popup-details p strong {
    color: var(--heading-color);
    margin-right: 5px;
}

.popup-details .status-badge {
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    color: #fff;
}

.popup-details .status-badge.active { background-color: #28a745; }
.popup-details .status-badge.inactive { background-color: #dc3545; }
.popup-details .status-badge.pending { background-color: #ffc107; color: #333; }

/* Styles pour les sections d'information de commande (view_partner_paid_orders) */
.content-section {
    background-color: var(--card-background);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 5px 15px var(--shadow-color);
    margin-top: 30px;
}
.content-section h2 {
    color: var(--heading-color);
    text-align: center;
    margin-bottom: 25px;
    font-size: 2em;
    position: relative;
}

.partner-details-header {
    background-color: var(--background-color);
    padding: 25px;
    border-radius: 10px;
    margin-bottom: 30px;
    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3);
    text-align: center;
}

.partner-details-header h3 {
    color: var(--primary-color-light);
    font-size: 2.2em;
    margin-bottom: 10px;
}

.partner-details-header p {
    color: var(--text-color);
    font-size: 1.1em;
    margin: 5px 0;
}

.partner-details-header p strong {
    color: var(--heading-color);
    margin-right: 5px;
}

.order-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.order-item {
    background-color: var(--background-color);
    margin-bottom: 20px;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--subtle-border-color);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.order-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
}

.order-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px dashed var(--subtle-border-color);
}

.order-header h4 {
    color: var(--primary-color-light);
    font-size: 1.5em;
    margin: 0;
}

.order-header .status {
    font-weight: bold;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.9em;
}

/* Correction: Utilisation de variables CSS pour les couleurs de statut si possible, ou consolidation */
.order-header .status.pending { background-color: var(--info-color); color: #333; } /* Changed to info-color */
.order-header .status.active { background-color: var(--success-color); color: #fff; }
.order-header .status.completed { background-color: var(--info-color); color: #fff; } /* Changed to info-color, or define a specific 'completed' color */
.order-header .status.canceled { background-color: var(--danger-color); color: #fff; }
.order-header .status.payée { background-color: var(--success-color); color: #fff; }
.order-header .status.partiellement_remboursée { background-color: var(--info-color); color: #fff; }
.order-header .status.remboursée { background-color: var(--danger-color); color: #fff; }


.order-details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.order-details-grid div {
    background-color: var(--background-color);
    padding: 10px 15px;
    border-radius: 8px;
    border: 1px solid var(--subtle-border-color);
}

.order-details-grid strong {
    color: var(--primary-color);
    display: block;
    margin-bottom: 5px;
    font-size: 0.95em;
}

.order-details-grid span {
    font-size: 0.9em;
}

.order-total-summary {
    text-align: right;
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed var(--subtle-border-color);
}

.order-total-summary p {
    margin: 5px 0;
    font-size: 1.1em;
    color: var(--heading-color);
}

.order-total-summary .total-amount {
    font-size: 1.3em;
    color: var(--primary-color-light);
    font-weight: bold;
}

/* Styles spécifiques pour les prix et bénéfices */
.total-purchase-price {
    font-size: 0.9em; /* Petit */
    color: var(--info-color); /* Bleu */
    font-weight: normal;
}

.total-benefit {
    font-size: 0.9em; /* Petit */
    color: var(--success-color); /* Vert */
    font-weight: bold;
}

.article-list {
    margin-top: 20px;
    border-top: 1px solid var(--subtle-border-color);
    padding-top: 15px;
}

.article-list h5 {
    color: var(--heading-color);
    font-size: 1.2em;
    margin-bottom: 10px;
    text-align: center;
}

.table-wrapper {
    overflow-x: auto; /* Permet le défilement horizontal si le contenu dépasse */
    -webkit-overflow-scrolling: touch; /* Améliore le défilement sur iOS */
}

.article-table {
    width: 100%;
    min-width: 760px; /* Largeur minimale pour le tableau avant que le défilement ne s'active. Ajustez si nécessaire. */
    border-collapse: collapse;
    margin-top: 10px;
}

.article-table th, .article-table td {
    border: 1px solid var(--subtle-border-color);
    padding: 10px;
    text-align: left;
    font-size: 0.9em;
}

.article-table th {
    background-color: var(--primary-color-dark);
    color: var(--heading-color);
    font-weight: bold;
}

.article-table td {
    background-color: var(--card-background); /* Déplacé ici pour plus de spécificité */
}
.article-table tr:nth-child(even) td {
    background-color: #333333; /* Slightly different background for even rows */
}
.article-table .benefice-col {
    color: var(--success-color);
    font-weight: bold;
}
.article-table .purchase-col {
    color: var(--info-color);
}

.no-orders {
    text-align: center;
    color: var(--text-color);
    opacity: 0.7;
    padding: 20px;
    border: 1px dashed var(--subtle-border-color);
    border-radius: 8px;
    margin-top: 20px;
}

/* ========================================= */
/* Media Queries pour la responsivité */
/* ========================================= */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
        position: fixed;
        height: 100%;
        z-index: 998;
    }

    .sidebar.active {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        width: 100%;
    }

    body.sidebar-open {
        overflow: hidden; /* Empêche le défilement du contenu principal */
    }

    .menu-toggle {
        display: block; /* Affiche le bouton de menu */
        margin-right: 15px; /* Espace avant le titre */
    }

    .main-header h2 {
        flex-grow: 1; /* Permet au titre de prendre l'espace restant */
        text-align: left;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 15px;
    }

    .main-header {
        padding: 15px 20px;
        margin-bottom: 20px;
    }

    .main-header h2 {
        font-size: 1.8em;
    }

    .dashboard-overview {
        grid-template-columns: 1fr; /* Une seule colonne sur mobile */
        gap: 20px;
    }

    .card.chart-card {
        grid-column: span 1; /* Ne prend qu'une colonne sur mobile */
        height: 300px; /* Ajustement de la hauteur pour les écrans de taille moyenne */
    }

    .card h3 {
        font-size: 1.2em;
    }

    .card p {
        font-size: 2em;
    }

    .card i {
        font-size: 2.5em;
    }

    .recent-merchants {
        padding: 20px;
    }

    .recent-merchants h3 {
        font-size: 1.6em;
    }

    .recent-merchants th,
    .recent-merchants td {
        padding: 10px;
        font-size: 0.85em;
    }

    /* Styles pour view_partner_paid_orders */
    .content-section {
        padding: 20px;
        margin-top: 60px; /* Adjusted to clear header */
    }

    .content-section h2 {
        font-size: 1.8em;
        margin-bottom: 20px;
    }

    .partner-details-header h3 {
        font-size: 1.8em;
    }
    .partner-details-header p {
        font-size: 1em;
    }

    .order-item {
        padding: 15px;
    }
    .order-header h4 {
        font-size: 1.3em;
    }
    .order-details-grid {
        grid-template-columns: 1fr; /* Une seule colonne sur mobile */
        gap: 10px;
    }
    .article-table th, .article-table td {
        padding: 8px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .main-header {
        padding: 10px 15px;
    }
    .main-header h2 {
        font-size: 1.5em;
    }

    .card {
        padding: 15px;
    }

    .card.chart-card {
        height: 250px; /* Ajustement de la hauteur pour les très petits écrans */
    }

    .card h3 {
        font-size: 1em;
    }

    .card p {
        font-size: 1.8em;
    }

    .card i {
        font-size: 2em;
    }

    .recent-merchants h3 {
        font-size: 1.4em;
    }

    .search-container input[type="text"] {
        padding: 10px 35px 10px 15px;
        font-size: 0.9em;
    }

    .search-icon {
        font-size: 1em;
        right: 10px;
    }

    .management-section {
        padding: 20px;
    }
    .management-section h2 {
        font-size: 1.8em;
    }
    .management-table th, .management-table td {
        padding: 8px;
        font-size: 0.8em;
    }

    .btn {
        padding: 10px 20px;
        font-size: 1em;
    }

    .form-container {
        padding: 20px;
    }
    .form-container h2 {
        font-size: 1.8em;
    }
    .form-group label {
        font-size: 0.9em;
    }
    .form-group input, .form-group textarea, .form-group select {
        padding: 10px;
        font-size: 0.9em;
    }

    /* Styles pour view_partner_paid_orders */
    .content-section {
        padding: 15px;
        margin-top: 50px; /* Adjusted to clear header */
    }
    .partner-details-header h3 {
        font-size: 1.6em;
    }
    .order-item {
        padding: 10px;
    }
    .order-header {
        flex-direction: column;
        align-items: flex-start;
        margin-bottom: 10px;
    }
    .order-header h4 {
        font-size: 1.2em;
        margin-bottom: 5px;
    }
    .order-details-grid strong, .order-details-grid span {
        font-size: 0.85em;
    }
    .order-total-summary p {
        font-size: 1em;
    }
    .order-total-summary .total-amount {
        font-size: 1.1em;
    }
    .article-table {
        font-size: 0.8em;
    }
    .article-table th, .article-table td {
        padding: 6px;
    }
}