/**
 * EVOC AIR - MODULE BALAYAGE & PRELEVEMENTS CCP
 * Styles dédiés pour les vues Balayage & Détails
 */

.balayage-page-container {
    padding: 0;
}

.balayage-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 14px;
    flex-wrap: wrap;
    gap: 10px;
}

.balayage-header-title {
    margin: 0;
    font-size: 21px;
    font-weight: 800;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 9px;
}

.balayage-header-subtitle {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* Barre des Onglets */
.balayage-tab-strip {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 6px;
}

.balayage-tab-btn {
    background: none;
    border: none;
    padding: 8px 18px;
    font-weight: 700;
    font-size: 13.5px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
}

.balayage-tab-btn:hover:not(.active) {
    background: #f1f5f9;
    color: var(--text-main);
}

.balayage-tab-btn.active {
    background: var(--primary);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(79, 70, 229, 0.2);
}

/* Carte de Contenu Principale */
.balayage-content-card {
    background: var(--card-bg, #ffffff);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Barre d'outils / Dropzone */
.balayage-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    transition: background-color 0.2s, border-color 0.2s;
}

.balayage-toolbar.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.04);
}

.balayage-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.bal-label {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--text-muted);
    white-space: nowrap;
}

.bal-input-text {
    font-size: 12.5px;
    height: 32px;
}

.bal-input-date {
    font-size: 12px;
    height: 32px;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: #ffffff;
}

/* Grilles & Tableaux de données */
.balayage-grid-wrapper {
    overflow-x: auto;
    max-height: calc(100vh - 300px);
    min-height: 380px;
    position: relative;
}

.balayage-grid-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12.5px;
    text-align: left;
}

.balayage-grid-table th {
    background: #f8fafc;
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 2;
    white-space: nowrap;
}

.balayage-grid-table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border-color);
    vertical-align: middle;
}

/* Statuts de lignes */
.balayage-row-paye {
    background: rgba(22, 163, 74, 0.04);
    color: #15803d;
    font-weight: 700;
}

.balayage-row-impaye {
    background: rgba(220, 38, 38, 0.04);
    color: #dc2626;
    font-weight: 700;
}

.balayage-badge-paye {
    background: #dcfce7;
    color: #15803d;
    font-weight: 800;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.balayage-badge-impaye {
    background: #fee2e2;
    color: #dc2626;
    font-weight: 800;
    padding: 3px 8px;
    font-size: 12px;
    border-radius: 4px;
}

.balayage-text-mono {
    font-family: monospace;
    font-weight: 700;
}

.balayage-table-summary-row {
    background: #f8fafc;
    border-top: 2px solid var(--border-color);
    position: sticky;
    bottom: 0;
    z-index: 2;
}

.balayage-table-summary-row td {
    padding: 10px 12px;
    font-weight: 800;
    font-size: 13px;
}

/* Bouton interactif Fiche Client dans les tableaux de balayage */
.balayage-client-btn {
    background: transparent;
    border: none;
    padding: 3px 8px;
    margin: 0;
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--primary, #4f46e5);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border-radius: 5px;
    text-align: left;
    transition: all 0.15s ease;
}

.balayage-client-btn:hover {
    background: #eef2ff;
    color: #3730a3;
    text-decoration: underline;
}

.balayage-client-btn:active {
    transform: scale(0.98);
}

/* Barre d'actions inférieure */
.balayage-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: #f8fafc;
    border-top: 1.5px solid var(--border-color);
    flex-wrap: wrap;
    gap: 10px;
}

/* Disposition Split Master-Detail (Onglet Détails) */
.balayage-details-split-container {
    display: flex;
    min-height: calc(100vh - 270px);
}

.balayage-files-sidebar {
    width: 280px;
    min-width: 250px;
    border-right: 1.5px solid var(--border-color);
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.balayage-files-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    background: #ffffff;
}

.balayage-files-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
    max-height: calc(100vh - 360px);
}

.balayage-files-list::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.balayage-files-list::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.balayage-files-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.balayage-files-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.balayage-file-item {
    padding: 10px 14px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer;
    transition: all 0.15s ease;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    white-space: nowrap;
    width: max-content;
    min-width: 100%;
    box-sizing: border-box;
}

.balayage-file-item .file-name {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
}

.balayage-file-item:hover {
    background: #f1f5f9;
    color: var(--primary);
}

.balayage-file-item.selected {
    background: rgba(79, 70, 229, 0.08);
    color: var(--primary);
    font-weight: 800;
    border-left: 3px solid var(--primary);
}

.balayage-details-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: #ffffff;
}

.balayage-details-top-bar {
    padding: 10px 16px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.balayage-status-chips-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: #ffffff;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.balayage-details-grid-wrapper {
    flex: 1;
    overflow-x: auto;
    max-height: calc(100vh - 380px);
    min-height: 320px;
    position: relative;
}

.balayage-empty-placeholder {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.balayage-empty-icon-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f1f5f9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

/* Pilule KPI TTaxes (Pénalités) */
.balayage-kpi-pill.kpi-ttaxes {
    background: #f1f5f9;
    border: 1.5px solid #fed7aa;
}

.balayage-kpi-pill.kpi-ttaxes .kpi-value {
    background: linear-gradient(90deg, #c2410c, #ea580c);
    color: #ffffff;
    padding: 2px 10px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 14px;
}

/* En-têtes interactifs de tri et de recherche par colonne */
.bal-th-sortable {
    cursor: pointer;
    user-select: none;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bal-th-sortable:hover {
    background: #f1f5f9 !important;
    color: var(--primary) !important;
}

.bal-th-interactive {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.bal-th-interactive:hover {
    background: #f1f5f9 !important;
}

.bal-th-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}

.bal-th-icons {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.grid-icons {
    font-size: 11px;
    opacity: 0.45;
    transition: all 0.15s ease;
    cursor: pointer;
}

th:hover .grid-icons,
.grid-icons:hover {
    opacity: 1;
    color: var(--primary);
}

.bal-th-sortable.active-sort .grid-icons,
.bal-th-interactive.active-sort .grid-icons {
    opacity: 1;
    color: var(--primary);
    font-size: 12.5px;
}

.bal-th-search-btn {
    background: transparent;
    border: none;
    padding: 2px 5px;
    border-radius: 4px;
    color: #64748b;
    font-size: 11px;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.bal-th-search-btn:hover,
.bal-th-search-btn.active {
    background: rgba(37, 99, 235, 0.12);
    color: var(--primary);
}

.bal-th-search-btn .filter-dot {
    position: absolute;
    top: 1px;
    right: 1px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary);
}

.bal-th-interactive.filter-active {
    color: var(--primary) !important;
    border-bottom: 2px solid var(--primary) !important;
}

/* Popover flottant de recherche par colonne */
.bal-column-search-popover {
    position: absolute;
    top: calc(100% + 2px);
    left: 4px;
    z-index: 100;
    text-transform: none;
    font-weight: normal;
    font-family: inherit;
    animation: balPopoverFadeIn 0.15s ease;
}

@keyframes balPopoverFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

