/* 
 * Main CSS - Styles principaux de l'application Jbiz&Sons
 */

/* Variables CSS */
:root { 
    --sidebar-width: 250px; 
    --header-height: 70px;
    
    /* Couleurs principales */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --danger-gradient: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    --warning-gradient: linear-gradient(135deg, #f2994a 0%, #f2c94c 100%);
    --success-gradient: linear-gradient(135deg, #56ab2f 0%, #a8e063 100%);
    
    /* Couleurs */
    --bg-light: #f5f6fa;
    --text-dark: #333;
    --text-muted: #6c757d;
    --white: #ffffff;
    
    /* Ombres */
    --shadow-sm: 0 2px 10px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 15px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 25px rgba(0,0,0,0.15);
    
    /* Transitions */
    --transition-fast: all 0.2s ease;
    --transition-normal: all 0.3s ease;
}

/* Body */
body { 
    background: var(--bg-light); 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
    color: var(--text-dark);
}

/* Header */
.top-header { 
    height: var(--header-height); 
    background: var(--primary-gradient); 
    color: var(--white); 
    position: fixed; 
    top: 0; 
    left: 0; 
    right: 0; 
    z-index: 1000; 
    box-shadow: var(--shadow-sm); 
    padding: 0 1rem;
}

.header-logo { 
    height: 50px; 
    width: auto; 
}

.header-title {
    white-space: nowrap;
    font-size: 1.25rem;
}

.header-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.header-icon-btn:hover {
    opacity: 0.8;
}

.header-user-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.header-user-btn:hover {
    opacity: 0.8;
}


/* Sidebar */
.sidebar { 
    position: fixed; 
    top: var(--header-height); 
    left: 0; 
    width: var(--sidebar-width); 
    height: calc(100vh - var(--header-height)); 
    background: var(--white); 
    box-shadow: var(--shadow-sm); 
    padding: 20px 0; 
    overflow-y: auto; 
    transition: var(--transition-normal);
}

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

.sidebar-menu li a { 
    display: flex; 
    align-items: center; 
    padding: 12px 25px; 
    color: var(--text-dark); 
    text-decoration: none; 
    transition: var(--transition-normal); 
    border-left: 3px solid transparent;
}

.sidebar-menu li a:hover { 
    background: rgba(102, 126, 234, 0.1); 
    color: #667eea;
    border-left-color: #667eea;
}

.sidebar-menu li a.active { 
    background: var(--primary-gradient); 
    color: var(--white); 
    border-left-color: #764ba2;
}

.sidebar-menu li a i { 
    margin-right: 12px; 
    font-size: 1.2rem; 
}

/* Content principal */
.main-content { 
    margin-left: var(--sidebar-width); 
    margin-top: var(--header-height); 
    padding: 30px; 
    min-height: calc(100vh - var(--header-height));
}

/* Cards */
.card {
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-normal);
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

/* Badges pour les rôles */
.badge-role { 
    padding: 5px 12px; 
    border-radius: 20px; 
    font-size: 0.85rem; 
    color: var(--white);
    font-weight: 500;
}

.badge-admin { 
    background: var(--danger-gradient); 
}

.badge-manager { 
    background: var(--warning-gradient); 
}

.badge-gerante { 
    background: var(--success-gradient); 
}

/* Tableaux */
.table {
    background: var(--white);
    border-radius: 10px;
    overflow: hidden;
}

.table thead {
    background: var(--primary-gradient);
    color: var(--white);
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
}

/* Forms */
.form-control:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.form-label {
    font-weight: 500;
    color: var(--text-dark);
    margin-bottom: 0.5rem;
}

/* Alerts */
.alert {
    border: none;
    border-radius: 10px;
    padding: 15px 20px;
}

/* Loading spinner */
.spinner-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 300px;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state i {
    font-size: 4rem;
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state p {
    color: var(--text-muted);
    margin-top: 1rem;
    font-size: 1.1rem;
}

/* Responsive */
@media (max-width: 991px) {
    :root {
        --sidebar-width: 0;
    }
    
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        width: 250px;
        height: calc(100vh - 60px);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1001;
        background: var(--white);
    }
    
    .sidebar.show {
        transform: translateX(0);
    }
}

.menu-toggle-btn {
    display: none;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    border: none;
    background: transparent;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    position: relative;
    z-index: 1002;
}

.menu-toggle-btn:focus {
    outline: 2px solid rgba(255,255,255,0.75);
    outline-offset: 3px;
}

.sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 1000;
}

.sidebar-backdrop.show {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.sidebar-open {
    overflow: hidden;
}

@media (max-width: 991px) {
    .menu-toggle-btn {
        display: inline-flex;
    }

    .top-header {
        padding: 0.5rem 1rem;
        height: 60px;
    }

    .header-logo {
        height: 40px;
    }

    .header-title {
        font-size: 1rem;
    }

    .header-icon-btn {
        min-width: 40px;
        min-height: 40px;
    }

    .header-user-btn {
        min-width: 40px;
        min-height: 40px;
    }

    .top-header .d-flex.align-items-center {
        gap: 0.5rem;
    }

    .top-header h3 {
        font-size: 1rem;
    }

    /* Boutons responsive - taille réduite */
    .btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.9rem;
    }

    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }

    /* Filtres en ligne réorganisés */
    .card-body .row {
        gap: 0.5rem;
    }

    .card-body .row > [class*='col-'] {
        min-width: 0;
    }

    /* Tableaux avec scroll */
    .table {
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    /* IMPORTANT: Contenu principal - largeur complète en responsive */
    .main-content {
        margin-left: 0 !important;
        margin-top: 60px;
        padding: 1.5rem 1rem;
        width: 100%;
    }
}

@media (max-width: 576px) {
    .top-header {
        height: 55px;
        padding: 0.5rem 0.75rem;
    }

    .header-icon-btn,
    .header-user-btn {
        min-width: 36px;
        min-height: 36px;
    }

    .badge-role {
        font-size: 0.7rem;
        padding: 2px 6px;
    }

    /* Boutons responsifs - masquer le texte */
    .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.85rem;
    }

    .btn i {
        margin-right: 0.25rem;
    }

    .btn-sm {
        padding: 0.25rem 0.375rem;
        font-size: 0.75rem;
    }

    /* Masquer le texte des boutons, garder les icônes */
    .btn:not(:has(i:only-child)) i {
        margin-right: 0.25rem;
    }

    /* Filtres responsifs */
    .card .row {
        flex-direction: column;
    }

    .card .col-md-2,
    .card .col-md-3,
    .card .col-md-4 {
        flex: 0 0 100%;
        max-width: 100%;
        margin-bottom: 0.75rem;
    }

    .card .card-body .row > [class*='col-'] {
        margin-bottom: 0.75rem;
    }

    /* Tableaux responsifs */
    .table {
        font-size: 0.85rem;
    }

    .table thead {
        font-size: 0.8rem;
    }

    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
    }

    .table-wrapper,
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Masquer certaines colonnes sur très petit écran */
    .table th:nth-child(n+4),
    .table td:nth-child(n+4) {
        font-size: 0.75rem;
    }

    /* Boutons dans les tableaux */
    .btn-group .btn,
    .btn-sm {
        padding: 0.25rem 0.375rem;
        font-size: 0.7rem;
    }

    /* Actions compactes */
    .action-buttons {
        display: flex;
        gap: 0.25rem;
    }

    .action-buttons .btn {
        padding: 0.25rem 0.375rem;
        min-width: auto;
    }

    /* Contenu principal réduit */
    .main-content {
        padding: 1rem 0.75rem;
    }

    .main-content h1 {
        font-size: 1.5rem;
        margin-bottom: 0.75rem;
    }

    .main-content h2 {
        font-size: 1.25rem;
        margin-bottom: 0.5rem;
    }

    .main-content p {
        font-size: 0.9rem;
        margin-bottom: 0.5rem;
    }

    /* Cartes compactes */
    .card {
        margin-bottom: 1rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .card-title {
        font-size: 1rem;
    }

    /* Alertes compactes */
    .alert {
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }
}


/* Scrollbar personnalisée */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #764ba2;
}
