/* ========================================
   ERP MANGUE - DESIGN PROFESSIONNEL COMPLET
   Thème : Bleu & Or
   Version 3.0 - Interface Premium
   Domaine : mango.gebanafaso.com
   ======================================== */

/* ----------------------------------------
   1. VARIABLES GLOBALES
---------------------------------------- */
:root {
    /* Couleurs principales */
    --primary: #1a73e8;
    --primary-light: #4285f4;
    --primary-dark: #0d47a1;
    --secondary: #f9ab00;
    --secondary-dark: #ea8600;
    --secondary-light: #ffc107;
    --accent: #e67e22;
    --accent-light: #f39c12;
    --accent-dark: #d35400;
    
    /* Couleurs neutres */
    --dark: #1e293b;
    --dark-light: #334155;
    --light: #f8fafc;
    --white: #ffffff;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --border: #e0e0e0;
    
    /* Ombres */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 8px 12px rgba(0, 0, 0, 0.15);
    
    /* Dimensions */
    --sidebar-width: 280px;
    --header-height: 60px;
    
    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Polices */
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-heading: 'Inter', 'Segoe UI', sans-serif;
}

/* ----------------------------------------
   2. RESET & BASE
---------------------------------------- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-main);
    background: #f0f2f5;
    color: #333;
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
}

/* ----------------------------------------
   3. SIDEBAR - Design Premium
---------------------------------------- */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(145deg, #0f172a, #0a0f1c);
    color: #e2e8f0;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Scrollbar personnalisée */
.sidebar::-webkit-scrollbar {
    width: 5px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--secondary);
    border-radius: 10px;
}

/* En-tête sidebar */
.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.2);
}

/* Logo */
.logo-wrapper {
    margin-bottom: 12px;
}

.logo-circle {
    width: 80px;
    height: 80px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    transition: var(--transition);
    overflow: hidden;
}

.logo-circle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(249, 171, 0, 0.2);
}

.logo-img {
    max-width: 55px;
    max-height: 55px;
    object-fit: contain;
}

.brand-title {
    font-size: 1.3rem;
    font-weight: 700;
    margin: 10px 0 2px;
    color: white;
    letter-spacing: -0.5px;
}

.brand-title span {
    color: var(--secondary);
}

.brand-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 2px;
}

/* Profil utilisateur */
.user-profile {
    display: flex;
    align-items: center;
    padding: 15px;
    margin: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 14px;
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.user-profile:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: translateX(3px);
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, var(--secondary), var(--secondary-dark));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.user-avatar i {
    font-size: 1.5rem;
    color: white;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
    display: block;
    color: white;
}

.user-role {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Navigation */
.sidebar-menu {
    padding: 10px 15px;
}

.menu-section {
    margin-bottom: 20px;
}

.menu-title {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255, 255, 255, 0.4);
    padding: 0 10px;
    margin-bottom: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    margin: 2px 0;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    transition: var(--transition);
    cursor: pointer;
}

.menu-item i {
    font-size: 1.1rem;
    width: 28px;
    color: var(--secondary);
    transition: var(--transition);
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: white;
    transform: translateX(4px);
}

.menu-item:hover i {
    transform: scale(1.1);
}

.menu-item.active {
    background: rgba(249, 171, 0, 0.15);
    color: var(--secondary);
    border-left: 3px solid var(--secondary);
}

.menu-text {
    flex: 1;
    font-size: 0.85rem;
    font-weight: 500;
}

.menu-badge {
    font-size: 0.6rem;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(249, 171, 0, 0.2);
    color: var(--secondary);
}

/* Sous-menus */
.submenu-toggle {
    cursor: pointer;
}

.submenu-toggle .toggle-icon {
    transition: transform 0.3s ease;
    font-size: 0.7rem;
}

.submenu-toggle.open .toggle-icon {
    transform: rotate(90deg);
}

.submenu {
    padding-left: 38px;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
}

.submenu.open {
    max-height: 500px;
    transition: max-height 0.5s ease-in;
}

.submenu .menu-item {
    padding: 8px 12px;
    font-size: 0.8rem;
}

.submenu .menu-item i {
    font-size: 0.9rem;
    width: 24px;
}

/* Footer sidebar */
.sidebar-footer {
    margin-top: auto;
    padding: 15px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.4);
}

.stat-item i {
    font-size: 0.7rem;
    color: var(--secondary);
}

.copyright {
    text-align: center;
    font-size: 0.6rem;
    color: rgba(255, 255, 255, 0.3);
}

/* ----------------------------------------
   4. MENU MOBILE
---------------------------------------- */
.mobile-menu-btn {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1002;
    display: none;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: white;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: var(--transition);
    color: var(--secondary);
}

.mobile-menu-btn:hover {
    background: var(--secondary);
    color: white;
    transform: scale(1.05);
}

.mobile-menu-btn i {
    font-size: 1.4rem;
}

.mobile-menu-btn.active {
    background: #ef4444;
    color: white;
}

.mobile-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ----------------------------------------
   5. CONTENU PRINCIPAL
---------------------------------------- */
.main-content {
    margin-left: var(--sidebar-width);
    padding: 25px 30px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
    background: #f5f7fa;
    width: 100%;
}

/* ----------------------------------------
   6. EN-TÊTE DE PAGE
---------------------------------------- */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    flex-wrap: wrap;
    gap: 15px;
}

.page-header h1 {
    font-size: 1.8rem;
    color: var(--dark);
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header h1 i {
    color: var(--primary);
}

/* ----------------------------------------
   7. CARTES KPI
---------------------------------------- */
.kpi-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(0, 0, 0, 0.05);
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

.card h3 {
    color: var(--primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card h3 i {
    font-size: 1rem;
    color: var(--secondary);
}

.card p {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark);
    margin: 0;
}

.card small {
    font-size: 0.75rem;
    color: var(--gray);
    display: block;
    margin-top: 8px;
}

/* ----------------------------------------
   8. TABLEAUX
---------------------------------------- */
.table-container {
    background: var(--white);
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
    margin: 20px 0;
    overflow-x: auto;
}

.table-container h2 {
    margin: 0 0 20px 0;
    font-size: 1.2rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 10px;
}

.table-container h2 i {
    color: var(--primary);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

table thead tr {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
}

table th {
    padding: 12px;
    font-weight: 600;
    text-align: left;
}

table td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-light);
}

table tbody tr:hover {
    background: #f8fafc;
}

/* Actions dans les tableaux */
.actions {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 10px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 0.85rem;
    transition: var(--transition);
    background: transparent;
    border: 1px solid var(--border);
    color: var(--dark);
    cursor: pointer;
}

.btn-icon:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ----------------------------------------
   9. BOUTONS
---------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-ajouter {
    background: var(--secondary);
    color: var(--dark);
}

.btn-ajouter:hover {
    background: var(--secondary-dark);
    color: white;
}

.btn-annuler {
    background: var(--gray);
    color: white;
}

.btn-annuler:hover {
    background: #475569;
}

.btn-danger {
    background: #dc2626;
    color: white;
}

.btn-danger:hover {
    background: #b91c1c;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

/* ----------------------------------------
   10. FORMULAIRES
---------------------------------------- */
.form-container {
    max-width: 90%;
    margin: 0 auto;
}

.form-page {
    display: flex;
    justify-content: center;
    padding: 20px;
}

.form {
    background: var(--white);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    padding: 30px;
    width: 100%;
    max-width: 1200px;
}

.form-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.form-section:last-child {
    border-bottom: none;
}

.form-section h3 {
    color: var(--primary);
    font-size: 1.1rem;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-section h3 i {
    color: var(--secondary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 15px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 8px;
    font-size: 0.85rem;
}

.form-group label i {
    color: var(--secondary);
    width: 18px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.1);
}

.form-help {
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 5px;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: flex-end;
    margin-top: 25px;
}

/* ----------------------------------------
   11. MESSAGES
---------------------------------------- */
.success {
    background: #d1fae5;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #10b981;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #dc2626;
}

.warning {
    background: #fef3c7;
    color: #92400e;
    padding: 12px 16px;
    border-radius: 10px;
    margin-bottom: 20px;
    border-left: 4px solid #f59e0b;
}

/* ----------------------------------------
   12. BADGES
---------------------------------------- */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 500;
}

.badge-success {
    background: #10b981;
    color: white;
}

.badge-warning {
    background: #f59e0b;
    color: white;
}

.badge-danger {
    background: #dc2626;
    color: white;
}

.badge-info {
    background: #06b6d4;
    color: white;
}

.badge-secondary {
    background: #64748b;
    color: white;
}

/* ----------------------------------------
   13. GRAPHIQUES
---------------------------------------- */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.chart-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    box-shadow: var(--shadow);
}

.chart-card h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-card h3 i {
    color: var(--primary);
}

canvas {
    max-width: 100%;
    height: auto;
}

/* ----------------------------------------
   14. LIENS RAPIDES
---------------------------------------- */
.quick-links {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-top: 25px;
    box-shadow: var(--shadow);
}

.quick-links h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    color: var(--dark);
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-links h3 i {
    color: var(--primary);
}

.quick-links ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    list-style: none;
}

.quick-links li a {
    display: inline-block;
    padding: 6px 14px;
    background: var(--light);
    color: var(--dark);
    text-decoration: none;
    border-radius: 20px;
    font-size: 0.8rem;
    transition: var(--transition);
}

.quick-links li a:hover {
    background: var(--primary);
    color: white;
}

/* ----------------------------------------
   15. DETAILS (voir.php)
---------------------------------------- */
.detail {
    background: var(--white);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.detail-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.detail-group {
    background: var(--light);
    border-radius: 12px;
    padding: 15px;
    border-left: 3px solid var(--primary);
}

.detail-group h3 {
    margin: 0 0 10px 0;
    font-size: 0.9rem;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.detail-group p {
    margin: 5px 0;
    font-size: 0.85rem;
}

.detail-group strong {
    min-width: 120px;
    display: inline-block;
    color: var(--dark);
}

/* ----------------------------------------
   16. RESPONSIVE
---------------------------------------- */
@media screen and (max-width: 1200px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .form-container {
        max-width: 95%;
    }
}

@media screen and (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
    }
    
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
        padding: 80px 16px 20px;
    }
    
    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .page-header h1 {
        font-size: 1.3rem;
    }
    
    .kpi-cards {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .card p {
        font-size: 1.5rem;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .form-actions {
        flex-direction: column;
    }
    
    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
    
    .detail-row {
        grid-template-columns: 1fr;
    }
    
    .table-container {
        padding: 12px;
    }
    
    table {
        font-size: 0.75rem;
    }
    
    th, td {
        padding: 8px;
    }
}

@media screen and (max-width: 480px) {
    .main-content {
        padding: 70px 12px 12px;
    }
    
    .card h3 {
        font-size: 0.75rem;
    }
    
    .badge {
        font-size: 0.65rem;
        padding: 3px 8px;
    }
    
    .menu-item {
        padding: 8px 10px;
    }
    
    .menu-text {
        font-size: 0.8rem;
    }
}

/* ----------------------------------------
   17. UTILITAIRES
---------------------------------------- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }

.d-flex { display: flex; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-10 { gap: 10px; }
.flex-wrap { flex-wrap: wrap; }

.w-100 { width: 100%; }

/* Status colors */
.text-primary { color: var(--primary); }
.text-secondary { color: var(--secondary); }
.text-success { color: #10b981; }
.text-warning { color: #f59e0b; }
.text-danger { color: #dc2626; }

.bg-primary { background: var(--primary); }
.bg-secondary { background: var(--secondary); }
.bg-success { background: #10b981; }
.bg-warning { background: #f59e0b; }
.bg-danger { background: #dc2626; }