:root {
    --primary-color: #263fc8;
    --primary-light: #4a5fd6;
    --primary-dark: #1d31a0;
    --devis-color: #263fc8;
    --information-color: #4175c4;
    --fournisseur-color: #6a9cdf;
    --secondary-color: #f5f7ff;
    --text-color: #4a4a4a;
    --border-color: #e0e0e0;
    --success-color: #4caf50;
    --warning-color: #ff9800;
    --danger-color: #f44336;
    
    /* Status colors */
    --status-nouveau: #4caf50;      /* Green */
    --status-nouveau-bg: #e8f5e9;
    --status-contacte: #2196f3;     /* Blue */
    --status-contacte-bg: #e3f2fd;
    --status-en-attente: #ff9800;   /* Orange */
    --status-en-attente-bg: #fff3e0;
    --status-converti: #9c27b0;     /* Purple */
    --status-converti-bg: #f3e5f5;
    --status-archive: #607d8b;      /* Blue Grey */
    --status-archive-bg: #eceff1;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: #f8f9fc;
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    width: 100%;
    overflow-x: hidden;
}

.header {
    background-color: var(--primary-color);
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 100;
    width: 100%;
}

.logo {
    font-size: 22px;
    font-weight: bold;
    display: flex;
    align-items: center;
    letter-spacing: 0.5px;
}

.logo i {
    font-size: 24px;
    margin-right: 10px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 20px;
    position: relative;
}

.user-badge {
    background-color: white;
    color: var(--primary-color);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: bold;
    cursor: pointer;
    position: relative;
}

/* User dropdown menu */
.user-dropdown {
    position: absolute;
    top: 45px;
    right: 0;
    background-color: white;
    border-radius: 4px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    width: 200px; /* Increased width */
    z-index: 1000;
    display: none;
}

.user-dropdown.show {
    display: block;
}

.user-dropdown-item {
    padding: 12px 15px;
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.user-dropdown-item:hover {
    background-color: var(--secondary-color);
}

.user-dropdown-item i {
    margin-right: 12px; /* Increased spacing */
    color: #333;
    font-size: 16px; /* Added explicit size */
    width: 20px; /* Fixed width for alignment */
    text-align: center; /* Center the icon in its fixed width */
}

.main-container {
    display: flex;
    flex: 1;
    width: 100%;
}

.content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

.breadcrumb {
    display: flex;
    margin-bottom: 15px;
    color: #777;
    font-size: 14px;
    flex-wrap: wrap;
}

.breadcrumb a {
    color: #777;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb .separator {
    margin: 0 10px;
}

.page-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

.page-subtitle {
    color: #777;
    font-size: 14px;
    margin-bottom: 20px;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.action-btn {
    padding: 10px 15px;
    background-color: white;
    border: none;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s;
    color: var(--text-color);
    display: flex;
    align-items: center;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.action-btn i {
    margin-right: 8px;
    font-size: 16px;
}

.action-btn:hover {
    background-color: var(--secondary-color);
}

.action-btn.primary {
    background-color: var(--primary-color);
    color: white;
}

.action-btn.primary:hover {
    background-color: var(--primary-dark);
}

.action-btn.danger {
    background-color: var(--danger-color);
    color: white;
}

.action-btn.danger:hover {
    background-color: #c62828;
}

.search-container {
    display: flex;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
}

.search-box {
    display: flex;
    flex: 1;
    min-width: 250px;
    position: relative;
}

.search-input {
    padding: 10px 10px 10px 40px;
    width: 100%;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    outline: none;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
}

.date-input {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    cursor: pointer;
    background-color: white;
    min-width: 120px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.search-btn {
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 4px;
    padding: 10px 15px;
    cursor: pointer;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.status-filter {
    display: flex;
    margin-bottom: 20px;
    gap: 10px;
    flex-wrap: wrap;
    width: 100%;
}

.status-btn {
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    border: 1px solid var(--border-color);
    background-color: white;
    transition: all 0.2s;
    flex-shrink: 0;
}

.status-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.status-btn.type-filter.active.devis {
    background-color: var(--devis-color);
    border-color: var(--devis-color);
}

.status-btn.type-filter.active.information {
    background-color: var(--information-color);
    border-color: var(--information-color);
}

.status-btn.type-filter.active.fournisseur {
    background-color: var(--fournisseur-color);
    border-color: var(--fournisseur-color);
}

.status-btn:hover:not(.active) {
    background-color: var(--secondary-color);
}

.lead-type {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    flex-shrink: 0;
}

.lead-type.devis {
    background-color: #e7f0ff;
    color: var(--devis-color);
}

.lead-type.information {
    background-color: #e8f0fa;
    color: var(--information-color);
}

.lead-type.fournisseur {
    background-color: #edf5fe;
    color: var(--fournisseur-color);
}

.lead-source {
    font-size: 12px;
    color: #777;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.toggle-sidebar {
    display: none;
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 20px;
    margin-right: 10px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    overflow-y: auto;
    padding: 20px;
}

.modal.open {
    display: flex;
}

.modal-content {
    background-color: white;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background-color: white;
    z-index: 10;
}

.modal-title {
    font-weight: bold;
    font-size: 18px;
}

.modal-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #777;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background-color: white;
    z-index: 10;
}

.form-group {
    margin-bottom: 15px;
}

.form-label {
    display: block;
    margin-bottom: 5px;
    font-size: 14px;
    color: #555;
}

.form-input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.form-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    background-color: white;
}

/* Image preview styles */
.image-preview {
    margin: 15px 0;
    text-align: center;
}

.image-preview img {
    max-width: 100%;
    max-height: 300px;
    border-radius: 4px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.download-link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background-color: var(--primary-light);
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
}

.download-link i {
    margin-right: 5px;
}

.no-image {
    padding: 20px;
    text-align: center;
    background-color: #f5f5f5;
    border-radius: 4px;
    color: #777;
}

/* Image gallery controls */
.image-gallery {
    position: relative;
    margin: 20px 0;
}

.image-gallery-nav {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    gap: 10px;
}

.image-gallery-control {
    background-color: #f5f5f5;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.image-gallery-control:hover {
    background-color: var(--primary-light);
    color: white;
}

.image-gallery-dots {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    gap: 5px;
}

.image-gallery-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ddd;
    cursor: pointer;
    transition: all 0.2s;
}

.image-gallery-dot.active {
    background-color: var(--primary-color);
}

.image-counter {
    text-align: center;
    margin-top: 5px;
    font-size: 12px;
    color: #777;
}

.image-download {
    text-align: center;
    margin-top: 10px;
}

/* Footer styles */
.footer {
    background-color: white;
    border-top: 1px solid var(--border-color);
    padding: 15px 20px;
    text-align: center;
    font-size: 14px;
    color: #777;
    width: 100%;
}

.footer .heart {
    color: #ff5252;
    margin: 0 3px;
}

/* Sidebar styles */
.sidebar {
    width: 260px;
    background-color: white;
    border-right: 1px solid var(--border-color);
    flex-shrink: 0;
    transition: all 0.3s ease;
    z-index: 99;
    height: calc(100vh - 60px);
    overflow-y: auto;
}

.sidebar .nav-item {
    padding: 15px 20px;
    display: flex;
    align-items: center;
    color: var(--text-color);
    text-decoration: none;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    cursor: pointer;
}

.sidebar .nav-item.active {
    border-left-color: var(--primary-color);
    background-color: var(--secondary-color);
    color: var(--primary-color);
}

.sidebar .nav-item:hover {
    background-color: var(--secondary-color);
}

.sidebar .nav-item i {
    font-size: 18px;
    width: 24px;
    margin-right: 15px;
    text-align: center;
    color: #333;
}

.sidebar .nav-item.active i {
    color: var(--primary-color);
}

.sidebar .nav-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Prospect and leads specific styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    overflow: hidden;
    table-layout: fixed;
}

.data-table th, .data-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: bold;
    color: #333;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tr:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-responsive {
    overflow-x: auto;
    margin-bottom: 20px;
    width: 100%;
    -webkit-overflow-scrolling: touch;
}

.action-buttons {
    display: flex;
    gap: 5px;
    justify-content: center;
    flex-wrap: nowrap;
}

.table-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background-color: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #555;
    transition: all 0.2s;
    font-size: 12px;
    flex-shrink: 0;
    text-decoration: none;
}

.table-action-btn:hover {
    background-color: var(--primary-light);
    color: white;
}

.prospect-name-cell, .lead-name-cell {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    padding-left: 10px;
}

.lead-avatar.small {
    width: 30px;
    height: 30px;
    font-size: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: white;
    font-weight: bold;
    border-radius: 50%;
    background-color: var(--primary-light);
    flex-shrink: 0;
}

.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 15px;
}

.pagination-btn {
    width: 32px;
    height: 32px;
    border-radius: 4px;
    background-color: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-btn:not(:disabled):hover {
    background-color: var(--primary-light);
    color: white;
}

#pageInfo {
    font-size: 14px;
    color: #777;
}

/* Type client badges */
.type-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.type-badge.particulier {
    background-color: #e3f2fd;
    color: #2196f3;
}

.type-badge.entreprise {
    background-color: #e8f5e9;
    color: #4caf50;
}

/* Statut badges */
.statut-badge, .status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.statut-badge.actif, .status-badge.nouveau {
    background-color: #e8f5e9;
    color: #4caf50;
}

.statut-badge.en_negociation, .status-badge.en_attente {
    background-color: #fff3e0;
    color: #ff9800;
}

.statut-badge.devis_envoye, .status-badge.contacte {
    background-color: #e3f2fd;
    color: #2196f3;
}

.statut-badge.converti, .status-badge.converti {
    background-color: #f3e5f5;
    color: #9c27b0;
}

.statut-badge.archive, .status-badge.archive {
    background-color: #eceff1;
    color: #607d8b;
}

/* Devis specific styles */
.statut-badge.en_attente {
    background-color: #fff3e0;
    color: #ff9800;
}

.statut-badge.accepte {
    background-color: #e8f5e9;
    color: #4caf50;
}

.statut-badge.refuse {
    background-color: #ffebee;
    color: #f44336;
}

.statut-badge.expire {
    background-color: #eceff1;
    color: #607d8b;
}

/* Lead detail styles */
.lead-detail-header {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.lead-avatar.large {
    width: 60px;
    height: 60px;
    font-size: 24px;
    margin-right: 20px;
}

.lead-detail-section {
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.lead-detail-label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #555;
}

.lead-detail-value {
    color: #333;
}

.lead-detail-value a {
    color: #333;
    text-decoration: none;
}

.lead-detail-value a:hover {
    text-decoration: underline;
}

/* Error message styles */
.error-message {
    padding: 10px;
    background-color: #ffebee;
    border: 1px solid #ffcdd2;
    border-radius: 4px;
    color: #b71c1c;
    margin-bottom: 15px;
}

/* Style ajustements pour le bouton reset */
#resetFilterBtn {
    margin-left: auto;
}

/* Reset button styles specific to Type filter */
#resetTypeFilterBtn:hover {
    background-color: var(--primary-color);
    color: white;
}

#resetTypeFilterBtn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#resetTypeFilterBtn.active i {
    color: white;
}

/* Mobile optimized table styles */
.data-table.mobile-optimized {
    display: table;
    width: 100%;
    font-size: 12px;
    background: none;
    box-shadow: none;
    border-radius: 0;
}

.data-table.mobile-optimized thead {
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table.mobile-optimized th, 
.data-table.mobile-optimized td {
    padding: 10px 8px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.data-table.mobile-optimized th {
    background-color: #f1f5ff;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table.mobile-optimized tr {
    background-color: white;
}

.data-table.mobile-optimized tr:nth-child(even) {
    background-color: #f9faff;
}

.data-table.mobile-optimized .action-buttons {
    gap: 3px;
}

.data-table.mobile-optimized .table-action-btn {
    width: 26px;
    height: 26px;
    font-size: 11px;
    border-radius: 50%;
}

/* Hide grid view completely */
.grid-view {
    display: none !important;
}

/* Document styles for devis */
.document-list {
    margin-top: 15px;
    margin-bottom: 15px;
}

.document-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    margin-bottom: 8px;
    background-color: white;
}

.document-icon {
    font-size: 24px;
    color: #f44336;
}

.document-info {
    flex: 1;
    min-width: 0;
}

.document-name {
    font-weight: 600;
    color: #333;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.document-meta {
    font-size: 12px;
    color: #777;
}

.document-actions {
    display: flex;
    gap: 5px;
}

.document-action-btn {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    background-color: #f5f5f5;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #555;
    transition: all 0.2s;
    font-size: 12px;
}

.document-action-btn:hover {
    background-color: var(--primary-light);
    color: white;
}

/* Responsive adjustments */
@media (max-width: 992px) {
    .sidebar {
        position: fixed;
        height: 100%;
        left: 0;
        transform: translateX(-100%);
        top: 60px;
        z-index: 99;
        box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .toggle-sidebar {
        display: block;
    }

    .content {
        margin-left: 0;
    }
    
    .table-responsive {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
        border-radius: 0;
    }
}

@media (max-width: 768px) {
    .actions {
        flex-direction: column;
        align-items: stretch;
    }
    
    .action-btn {
        width: 100%;
        justify-content: center;
    }
    
    .search-container {
        flex-direction: column;
    }
    
    .search-btn, #resetFilterBtn {
        width: 100%;
    }

    .modal-content {
        width: 95%;
        max-height: 80vh;
    }

    .modal-footer {
        flex-direction: column;
    }

    .modal-footer .action-btn {
        width: 100%;
    }

    .status-filter {
        overflow-x: auto;
        padding-bottom: 5px;
        scrollbar-width: none; /* Firefox */
        -ms-overflow-style: none; /* IE and Edge */
        flex-wrap: nowrap;
        width: 100%;
    }

    .status-filter::-webkit-scrollbar {
        display: none; /* Chrome, Safari and Opera */
    }

    .status-btn {
        white-space: nowrap;
        flex-shrink: 0;
    }
    
    .pagination {
        margin-top: 10px;
    }
    
    .lead-detail-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .lead-avatar.large {
        margin-bottom: 15px;
    }
    
    /* Mobile table adjustments */
    .data-table {
        font-size: 12px;
        width: 100%;
    }
    
    .data-table th, .data-table td {
        padding: 10px 8px;
    }
    
    /* Sur tablettes, on cache certaines colonnes moins importantes */
    .data-table th:nth-child(n+4):nth-child(-n+5), 
    .data-table td:nth-child(n+4):nth-child(-n+5) {
        display: none;
    }
    
    /* Style natif pour tableau mobile */
    .data-table.mobile-optimized {
        margin-left: -15px;
        margin-right: -15px;
        width: calc(100% + 30px);
    }
    
    .table-responsive {
        padding: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        position: relative;
    }
    
    /* Indicateur de défilement */
    .table-responsive:after {
        content: '';
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 15px;
        background: linear-gradient(to right, transparent, rgba(255,255,255,0.8));
        pointer-events: none;
        opacity: 0;
        transition: opacity 0.3s;
    }
    
    .table-responsive.has-overflow:after {
        opacity: 1;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 10px 15px;
    }

    .logo {
        font-size: 18px;
    }

    .logo i {
        font-size: 20px;
    }

    .content {
        padding: 15px 10px;
    }

    .user-info {
        gap: 10px;
    }

    .user-badge {
        width: 32px;
        height: 32px;
    }

    .page-title {
        font-size: 20px;
    }
    
    /* Extreme mobile table adjustments */
    .data-table th:nth-child(n+3):not(:last-child), 
    .data-table td:nth-child(n+3):not(:last-child) {
        display: none;
    }
    
    .data-table th:first-child, 
    .data-table td:first-child {
        min-width: 150px;
        max-width: 150px;
        padding-left: 10px;
        padding-right: 10px;
    }
    
    .data-table th:last-child, 
    .data-table td:last-child {
        min-width: 100px;
        padding-left: 5px;
        padding-right: 5px;
    }
    
    /* Optimiser les boutons d'action sur mobile */
    .action-buttons {
        display: flex;
        justify-content: space-around;
    }
    
    .table-action-btn {
        width: 30px;
        height: 30px;
    }
    
    /* Ajustements pour les avatars/initiales sur mobile */
    .prospect-name-cell, .lead-name-cell {
        padding-left: 10px;
        padding-right: 10px;
        gap: 8px;
    }
    
    .lead-avatar.small {
        width: 28px;
        height: 28px;
        font-size: 11px;
        margin: 0;
    }
}