/* Top clients côte à côte */
.dashboard-top-clients-row {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
    grid-column: span 2;
    min-width: 0;
}

.dashboard-top-clients-col {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .dashboard-top-clients-row {
        flex-direction: column;
        gap: 10px;
    }
}

/* Sales Dashboard Styles */

/* Navigation secondaire (cohérence avec order.css) */
.secondary-nav {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
    background: var(--background-secondary);
    border-radius: 8px;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    transition: all 0.2s;
    background: var(--surface);
    border: 1px solid var(--border-color);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(94, 92, 230, 0.3);
    border-color: var(--primary);
}

.header-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.import-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.search-input {
    flex: 1;
    min-width: 250px;
    padding: 10px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}

.filter-select {
    padding: 10px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    cursor: pointer;
}

.filter-date {
    padding: 10px 15px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
}

/* Multi-select dropdown */
.multi-select-wrapper {
    position: relative;
}

.multi-select-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-width: 200px;
    gap: 10px;
}

.multi-select-btn .arrow {
    font-size: 10px;
    transition: transform 0.3s;
}

.multi-select-btn.active .arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    min-width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    max-height: 300px;
    overflow-y: auto;
}

.multi-select-dropdown.show {
    display: block;
}

.checkbox-label {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.2s;
    color: var(--text);
    font-size: 14px;
}

.checkbox-label:hover {
    background: rgba(94, 92, 230, 0.1);
}

.checkbox-label input[type="checkbox"] {
    margin-right: 10px;
    cursor: pointer;
}

.multi-select-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

.btn-link {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 12px;
    cursor: pointer;
    padding: 5px;
    text-decoration: underline;
}

.btn-link:hover {
    color: #7C7AE6;
}

/* Stats Cards */
.sales-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background: linear-gradient(135deg, var(--primary) 0%, #7C7AE6 100%);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.stat-value {
    font-size: 32px;
    font-weight: 700;
    color: white;
    margin-bottom: 5px;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
}

/* Table */
.table-container {
    overflow-x: auto;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
}

.sales-table {
    width: 100%;
    border-collapse: collapse;
}

.sales-table thead {
    background: rgba(94, 92, 230, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
}

.sales-table th {
    padding: 15px 10px;
    text-align: left;
    font-weight: 600;
    color: var(--primary);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.sales-table td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
}

.sales-table tbody tr:hover {
    background: rgba(94, 92, 230, 0.05);
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.status-paid {
    background: rgba(52, 211, 153, 0.2);
    color: #10B981;
}

.status-cancelled {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.type-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.type-normale {
    background: rgba(156, 163, 175, 0.2);
    color: #9CA3AF;
    border: 1px solid rgba(156, 163, 175, 0.4);
}

.type-police {
    background: rgba(59, 130, 246, 0.2);
    color: #3B82F6;
    border: 1px solid rgba(59, 130, 246, 0.4);
}

.type-ambulance {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.4);
}

.type-mechanic {
    background: rgba(245, 158, 11, 0.2);
    color: #F59E0B;
    border: 1px solid rgba(245, 158, 11, 0.4);
}

.type-gouvsud {
    background: rgba(139, 92, 246, 0.2);
    color: #8B5CF6;
    border: 1px solid rgba(139, 92, 246, 0.4);
}

.type-gruppe6 {
    background: rgba(16, 185, 129, 0.2);
    color: #10B969;
    border: 1px solid rgba(16, 185, 129, 0.4);
}

.type-reporter {
    background: rgba(236, 72, 153, 0.2);
    color: #EC4899;
    border: 1px solid rgba(236, 72, 153, 0.4);
}

.type-mine {
    background: rgba(120, 113, 108, 0.2);
    color: #78716C;
    border: 1px solid rgba(120, 113, 108, 0.4);
}

.type-realestate {
    background: rgba(6, 182, 212, 0.2);
    color: #06B6D4;
    border: 1px solid rgba(6, 182, 212, 0.4);
}

.type-neon {
    background: rgba(244, 114, 182, 0.2);
    color: #F472B6;
    border: 1px solid rgba(244, 114, 182, 0.4);
}

.type-rachat {
    background: rgba(255, 179, 0, 0.2);
    color: #FFB300;
    border: 1px solid rgba(255, 179, 0, 0.4);
}

.type-raven {
    background: rgba(49, 31, 115, 0.2);
    color: #6366F1;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.type-dollar {
    background: rgba(99, 102, 241, 0.2);
    color: #A5B4FC;
    border: 1px solid rgba(99, 102, 241, 0.4);
}

.type-pills {
    background: rgba(34, 197, 94, 0.2);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.type-ltd2 {
    background: rgba(168, 85, 247, 0.2);
    color: #A855F7;
    border: 1px solid rgba(168, 85, 247, 0.4);
}

.type-taxi {
    background: rgba(255, 221, 51, 0.2);
    color: #FFD900;
    border: 1px solid rgba(255, 221, 51, 0.4);
}

.type-doctor {
    background: rgba(34, 197, 94, 0.2);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.4);
}

.type-ron {
    background: rgba(251, 146, 60, 0.2);
    color: #FB923C;
    border: 1px solid rgba(251, 146, 60, 0.4);
}

.type-angels {
    background: rgba(236, 72, 153, 0.2);
    color: #EC4899;
    border: 1px solid rgba(236, 72, 153, 0.4);
}

.type-judge_ls {
    background: rgba(107, 114, 128, 0.2);
    color: #6B7280;
    border: 1px solid rgba(107, 114, 128, 0.4);
}

/* Direction badges and transaction styling */
.client-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.direction-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: bold;
}

.direction-revenue {
    background: rgba(16, 185, 129, 0.2);
    color: #10B981;
}

.direction-expense {
    background: rgba(239, 68, 68, 0.2);
    color: #EF4444;
}

.transaction-revenue {
    border-left: 3px solid #10B981;
}

.transaction-expense {
    border-left: 3px solid #EF4444;
}

.amount-revenue {
    color: #10B981 !important;
}

.amount-expense {
    color: #EF4444 !important;
}

/* Dashboard expense and profit cards */
.expense-card {
    border-left: 4px solid #EF4444;
}

.expense-card .kpi-value {
    color: #EF4444;
}

.profit-card {
    border-left: 4px solid #10B981;
}

.profit-positive {
    color: #10B981 !important;
}

.profit-negative {
    color: #EF4444 !important;
}

/* Sales list stat cards */
.expense-stat .stat-value {
    color: #EF4444;
}

.profit-stat .stat-value {
    color: #10B981;
}

.expense-stat {
    border-left: 3px solid #EF4444;
}

.profit-stat {
    border-left: 3px solid #10B981;
}

/* Period Filters */
.period-filters {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.period-btn {
    padding: 8px 16px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.period-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

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

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-top: 20px;
}

@media (max-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.dashboard-card.large {
    grid-column: span 2;
}

.dashboard-card.medium {
    grid-column: span 1;
}

@media (max-width: 768px) {

    .dashboard-card.large,
    .dashboard-card.medium {
        grid-column: span 1;
    }
}

.dashboard-card h3 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.dashboard-card canvas {
    max-height: 200px !important;
    height: 200px !important;
}

.dashboard-card.large canvas {
    max-height: 300px !important;
    height: 300px !important;
}

.dashboard-card.medium canvas {
    max-height: 280px !important;
    height: 280px !important;
}

/* Ajustement spécifique pour les graphiques doughnut */
#chart-client-types {
    max-height: 280px !important;
    height: 280px !important;
    margin: 0 auto;
    display: block;
}

.kpi-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    margin: 10px 0;
}

.kpi-evolution {
    font-size: 14px;
    margin-bottom: 15px;
    font-weight: 600;
}

.kpi-evolution.positive {
    color: #10B981;
}

.kpi-evolution.negative {
    color: #EF4444;
}

.kpi-evolution.neutral {
    color: #9CA3AF;
}

/* Top Clients List */
.top-client-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(94, 92, 230, 0.05);
    border-radius: 8px;
    border-left: 4px solid var(--primary);
}

.top-client-rank {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary);
    width: 40px;
}

.top-client-info {
    flex: 1;
    margin-left: 15px;
}

.top-client-name {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.top-client-details {
    font-size: 12px;
    color: var(--text-secondary);
}

.top-client-stats {
    text-align: right;
}

.top-client-total {
    font-size: 20px;
    font-weight: 700;
    color: var(--primary);
}

.top-client-visits {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    .dashboard-card.large {
        grid-column: span 1;
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }

    .sales-stats {
        grid-template-columns: 1fr;
    }
}

/* Import notification */
.import-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    background: var(--primary);
    color: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.import-notification.success {
    background: #10B981;
}

.import-notification.error {
    background: #EF4444;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: 12px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    margin: 0;
    color: var(--text);
    font-size: 1.2rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--surface-light);
    color: var(--text);
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

.form-group {
    margin-bottom: 1rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--background);
    color: var(--text);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(94, 92, 230, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 80px;
}

/* Styles Tombola */
.large-modal {
    max-width: 800px;
    width: 90%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}

.tombola-preview {
    background: var(--bg-secondary);
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1rem;
    border: 1px solid var(--border-color);
}

.preview-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-top: 0.5rem;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* .stat-value {
    font-weight: bold;
    color: var(--primary);
    font-size: 1.1rem;
} */

.tombola-results {
    display: grid;
    gap: 1rem;
}

.winner-card {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    position: relative;
    overflow: hidden;
}

.winner-card::before {
    content: '🎉';
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 2rem;
    opacity: 0.7;
}

.winner-rank {
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: #FFD700;
}

.winner-name {
    font-size: 1.4rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
}

.winner-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.9;
}

.winner-detail {
    display: flex;
    justify-content: space-between;
}

@media (max-width: 768px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .preview-stats {
        grid-template-columns: 1fr;
    }

    .winner-details {
        grid-template-columns: 1fr;
    }

    .large-modal {
        width: 95%;
    }
}

/* Styles pour la section rentabilité */
.card-header-with-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.profitability-controls {
    display: flex;
    gap: 0.5rem;
}

.profitability-controls select {
    padding: 0.25rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text-primary);
    font-size: 0.875rem;
}

.chart-info {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: rgba(94, 92, 230, 0.1);
    border-radius: 6px;
    border-left: 3px solid var(--primary);
}

.chart-info small {
    color: var(--text-secondary);
    font-style: italic;
}

.dashboard-card.large {
    min-height: 400px;
}

/* Responsive pour la section rentabilité */
@media (max-width: 768px) {
    .card-header-with-controls {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    .profitability-controls {
        flex-direction: column;
    }

    .dashboard-card.large {
        grid-column: span 1;
    }
}

/* Styles pour la modal des gagnants */
.autres-gagnants-link {
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    font-weight: 500;
    transition: color 0.2s ease;
}

.autres-gagnants-link:hover {
    color: var(--accent);
}

.gagnants-liste {
    max-height: 300px;
    overflow-y: auto;
}

.gagnant-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--surface);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all 0.2s ease;
}

.gagnant-item:hover {
    background: var(--background-secondary);
    transform: translateX(4px);
}

.gagnant-position {
    font-weight: bold;
    color: var(--accent);
    margin-right: 12px;
    min-width: 24px;
}

.gagnant-nom {
    color: var(--text);
    font-weight: 500;
}