/* ============================================
   JardinPro - Styles CSS
   Version 3.2 - Menu Horizontal - PLEINE LARGEUR
   ============================================ */

:root {
    --primary: #1B5E20;
    --primary-dark: #0D3B0F;
    --primary-light: #4CAF50;
    --secondary: #388E3C;
    --danger: #C62828;
    --danger-light: #FFCDD2;
    --warning: #F57C00;
    --warning-light: #FFE0B2;
    --success: #2E7D32;
    --success-light: #C8E6C9;
    --info: #1565C0;
    --info-light: #BBDEFB;
    --dark: #212121;
    --gray: #757575;
    --light: #F5F7F5;
    --white: #FFFFFF;
    --border: #E0E0E0;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: all 0.2s ease;
    --navbar-height: 60px;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light);
    color: var(--dark);
    margin: 0;
    padding: 0;
    min-height: 100vh;
    padding-top: var(--navbar-height);
}

/* ============================================
   FORCER PLEINE LARGEUR - PRIORITÉ MAXIMALE
   ============================================ */

/* Désactiver complètement le sidebar */
.sidebar,
aside.sidebar,
div.sidebar,
nav.sidebar {
    display: none !important;
    width: 0 !important;
    min-width: 0 !important;
    max-width: 0 !important;
    visibility: hidden !important;
    position: absolute !important;
    left: -9999px !important;
}

/* Layout sans sidebar */
.layout {
    display: block !important;
    min-height: 100vh;
    margin-left: 0 !important;
    padding-left: 0 !important;
}

/* Main content - PLEINE LARGEUR */
.main-content,
main.main-content,
div.main-content {
    margin-left: 0 !important;
    padding-left: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-height: calc(100vh - var(--navbar-height));
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Content wrapper - PLEINE LARGEUR */
.content-wrapper,
div.content-wrapper {
    padding: 1.5rem;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
}

/* Content area - PLEINE LARGEUR */
.content,
div.content {
    flex: 1;
    padding: 1.5rem 2rem;
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
}

/* ============================================
   HEADER INTERNE (sous la navbar)
   ============================================ */

.header,
header.header,
.top-header {
    background: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    position: sticky;
    top: var(--navbar-height);
    z-index: 100;
    margin-left: 0 !important;
    width: 100% !important;
}

.header-title,
.page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0;
}

.header-actions {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.header-date {
    color: #666;
    font-size: 0.9rem;
}

/* ============================================
   CARDS
   ============================================ */

.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.card-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--primary);
}

.card-body {
    padding: 1.5rem;
}

/* ============================================
   STATS CARDS
   ============================================ */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
    width: 100%;
}

.stat-card {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.stat-icon.primary { background: var(--primary); }
.stat-icon.secondary { background: var(--secondary); }
.stat-icon.success { background: var(--success); }
.stat-icon.warning { background: var(--warning); }
.stat-icon.danger { background: var(--danger); }
.stat-icon.info { background: var(--info); }

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--dark);
    line-height: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

/* ============================================
   TABLES
   ============================================ */

.table-container {
    overflow-x: auto;
    width: 100%;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--light);
    font-weight: 600;
    color: var(--primary);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.table tbody tr {
    transition: var(--transition);
}

.table tbody tr:hover {
    background: var(--light);
}

.table tbody tr.selected {
    background: var(--info-light);
}

/* ============================================
   STATUS BADGES
   ============================================ */

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-secondary { background: var(--border); color: var(--gray); }

/* ============================================
   BUTTONS
   ============================================ */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }

.btn-secondary { background: var(--secondary); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-info { background: var(--info); color: white; }
.btn-light { background: var(--light); color: var(--dark); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); }

.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.8rem 1.5rem; font-size: 1rem; }

/* ============================================
   FORMS
   ============================================ */

.form-group {
    margin-bottom: 1rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 0.6rem 1rem;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(27, 94, 32, 0.1);
}

.form-control.is-invalid {
    border-color: var(--danger);
}

.form-text {
    font-size: 0.8rem;
    color: var(--gray);
    margin-top: 0.25rem;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 100px;
}

/* ============================================
   MODAL
   ============================================ */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show,
.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: white;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: translateY(-20px);
    transition: var(--transition);
}

.modal-overlay.show .modal,
.modal-overlay.active .modal {
    transform: translateY(0);
}

.modal-lg { max-width: 900px; }
.modal-xl { max-width: 1200px; }

.modal-header {
    padding: 1rem 1.5rem;
    background: var(--primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.8;
    transition: var(--transition);
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* Fix: form dans un modal doit participer au flex layout */
.modal > form {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ============================================
   TOOLBAR
   ============================================ */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: 1rem;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 0.5rem;
}

.toolbar-search {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.toolbar-search input {
    width: 100%;
    padding-left: 2.5rem;
}

.toolbar-search i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray);
}

/* ============================================
   ALERTS
   ============================================ */

.alert {
    padding: 1rem 1.5rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.alert-success { background: var(--success-light); color: var(--success); }
.alert-danger { background: var(--danger-light); color: var(--danger); }
.alert-warning { background: var(--warning-light); color: var(--warning); }
.alert-info { background: var(--info-light); color: var(--info); }

/* ============================================
   TABS
   ============================================ */

.tabs {
    display: flex;
    border-bottom: 2px solid var(--border);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--primary);
}

.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ============================================
   PAGINATION
   ============================================ */

.pagination {
    display: flex;
    gap: 0.25rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.pagination a,
.pagination span {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--dark);
    transition: var(--transition);
}

.pagination a:hover {
    background: var(--light);
}

.pagination .active {
    background: var(--primary);
    color: white;
}

/* ============================================
   LOADING
   ============================================ */

.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================
   EMPTY STATE
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--gray);
}

.empty-state i {
    font-size: 4rem;
    opacity: 0.3;
    margin-bottom: 1rem;
}

/* ============================================
   LOGIN PAGE
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    padding: 1rem;
    padding-top: 0;
}

/* Page login - pas de padding-top */
body.login-body {
    padding-top: 0 !important;
}

.login-card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--primary);
    color: white;
    padding: 2rem;
    text-align: center;
}

.login-logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.login-subtitle {
    opacity: 0.8;
    font-size: 0.9rem;
}

.login-body {
    padding: 2rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 992px) {
    .header,
    .top-header {
        padding: 1rem 1.5rem;
    }
    
    .content,
    .content-wrapper {
        padding: 1rem 1.5rem;
    }
    
    /* FORCER: pas de marge gauche en responsive */
    .main-content,
    main.main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

@media (max-width: 768px) {
    .main-content,
    main.main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .header,
    .top-header {
        padding: 1rem;
        flex-direction: column;
        gap: 0.5rem;
        text-align: center;
    }
    
    .header-title,
    .page-title {
        font-size: 1.25rem;
    }
    
    .content,
    .content-wrapper {
        padding: 1rem;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-search {
        min-width: 100%;
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .table th,
    .table td {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
}

/* ============================================
   PRINT
   ============================================ */

@media print {
    .navbar,
    .header,
    .top-header,
    .toolbar,
    .btn {
        display: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    .main-content,
    main.main-content {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ============================================
   UTILITIES
   ============================================ */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--gray); }
.fw-bold { font-weight: 700; }
.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mt-2 { margin-top: 1rem; }
.d-flex { display: flex; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }

/* ============================================
   NEUTRALISER TOUTES LES ANCIENNES CLASSES SIDEBAR
   ============================================ */

.sidebar-header,
.sidebar-logo,
.sidebar-title,
.sidebar-version,
.sidebar-user,
.sidebar-user-name,
.sidebar-user-role,
.sidebar-nav,
.nav-section,
.nav-section-title,
.nav-link,
.sidebar-footer,
.nav-menu,
.nav-item,
.nav-section-items {
    /* Ces classes du sidebar ne doivent pas affecter le layout */
}

/* Classe spéciale pour les nav-item de l'ancien menu latéral */
aside .nav-item,
.sidebar .nav-item {
    display: none !important;
}
