/* ============================================
   Dashboard-specific styles
   ============================================ */

/* ============================================
   Outlier Action Modal
   ============================================ */
.outlier-action-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.85);
    z-index: 1500;
    display: flex;
    justify-content: center;
    align-items: center;
}
.outlier-action-modal-overlay.d-none {
    display: none !important;
}
.outlier-action-modal {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    max-width: 440px;
    width: 90%;
    box-shadow: var(--shadow-md);
}
.outlier-action-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
.outlier-action-modal-title {
    margin: 0;
    font-size: 1rem;
    color: var(--text-primary);
}
.outlier-action-modal-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.25rem;
    cursor: pointer;
    line-height: 1;
    padding: 0 0.25rem;
}
.outlier-action-modal-close:hover {
    color: var(--text-primary);
}
.outlier-action-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.outlier-action-summary {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin: 0;
}
.outlier-action-choices {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.outlier-action-choice-btn {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-secondary);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}
.outlier-action-choice-btn:hover {
    border-color: var(--primary);
    background: var(--bg-tertiary);
}
.outlier-action-choice-btn strong {
    font-size: 0.9rem;
    color: var(--text-primary);
}
.outlier-action-choice-btn span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.outlier-action-footnote {
    color: var(--text-muted);
    font-size: 0.78rem;
    margin: 0;
}

/* ============================================
   KPI Summary Bar
   ============================================ */
.kpi-summary-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    position: sticky;
    top: 56px;
    z-index: 50;
    box-shadow: var(--shadow);
    flex-wrap: wrap;
}
.kpi-summary-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}
.kpi-summary-value {
    font-size: 1.125rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 40px;
    text-align: right;
}
.kpi-summary-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}
.kpi-summary-separator {
    width: 1px;
    height: 24px;
    background: var(--border-color);
    flex-shrink: 0;
}
.kpi-good { color: #4ade80; }
.kpi-warning { color: #facc15; }
.kpi-bad { color: #fb7185; }
.kpi-neutral { color: var(--text-primary); }
.kpi-accent { color: var(--primary); }

/* ============================================
   Stratification Filter Bar
   ============================================ */
.strat-filter-bar {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 1.25rem;
    overflow: hidden;
}
.strat-filter-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}
.strat-filter-header:hover {
    background: var(--bg-secondary);
}
.strat-chevron {
    margin-left: auto;
    transition: transform 0.2s;
}
.strat-chevron--open {
    transform: rotate(180deg);
}
.strat-status {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.strat-status--inactive {
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.strat-status--active {
    background: rgba(96, 165, 250, 0.15);
    border: 1px solid var(--primary);
    color: var(--primary);
}
.strat-filter-body {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.strat-dimension {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.strat-dimension-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}
.strat-dimension-label {
    font-weight: 600;
    color: var(--text-primary);
}
.strat-dim-count {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.strat-chip-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    max-height: 120px;
    overflow-y: auto;
    padding: 0.2rem 0;
}
.strat-filter-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-top: 0.25rem;
    border-top: 1px solid var(--border-color);
}
.strat-row-count {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-left: auto;
}

/* ============================================
   Dashboard Header
   ============================================ */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.dashboard-header h1 {
    font-size: 1.5rem;
    font-weight: 700;
}
.dashboard-header .shape-badge {
    color: var(--text-secondary);
    font-size: 0.85rem;
}

/* ============================================
   Tables
   ============================================ */
.table-wrapper { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
thead th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: 0.6rem 0.75rem;
    text-align: left;
    font-weight: 600;
    position: sticky;
    top: 0;
    white-space: nowrap;
}
tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
tbody tr:hover { background: rgba(96,165,250,.05); }

/* Column type badges in headers */
thead th .col-type-badge {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.1rem 0.4rem;
    border-radius: 999px;
    margin-left: 0.4rem;
    vertical-align: middle;
    opacity: 0.9;
}
/* Header left border accent */
thead th[data-col-type]         { border-left: 3px solid transparent; }
thead th[data-col-type="integer"]     { border-left-color: var(--type-integer); }
thead th[data-col-type="float"]       { border-left-color: var(--type-float); }
thead th[data-col-type="categorical"] { border-left-color: var(--type-categorical); }
thead th[data-col-type="datetime"]    { border-left-color: var(--type-datetime); }
thead th[data-col-type="boolean"]     { border-left-color: var(--type-boolean); }

/* Stats table */
.stats-table { font-size: 0.85rem; }
.stats-table th { text-align: right; padding-right: 1rem; color: var(--text-secondary); font-weight: 500; }
.stats-table td { font-variant-numeric: tabular-nums; }

/* Stats cell highlights */
.stat-cell-warning {
    color: var(--warning);
    font-weight: 600;
}
.stat-cell-highlight {
    color: var(--primary-light);
    font-weight: 500;
}

/* Stats metric group separator (horizontal line between metric groups) */
.stats-table tr.metric-group-start th,
.stats-table tr.metric-group-start td {
    border-top: 2px solid var(--border-color);
}

/* ============================================
   Pagination
   ============================================ */
.pagination {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    margin-top: 1rem;
}
.page-selector {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.page-input {
    width: 60px;
    text-align: center;
    padding: 0.3rem 0.4rem;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
}
.page-select {
    width: auto;
    padding: 0.3rem 0.5rem;
    font-size: 0.85rem;
}
.page-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
}
.page-info {
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    margin-left: auto;
}
.pagination-separator {
    width: 1px;
    height: 20px;
    background: var(--border-color);
    margin: 0 0.25rem;
}

/* ============================================
   Chart containers
   ============================================ */
.chart-container { height: 450px; }
.chart-container-lg { height: 500px; }
.chart-container-auto { min-height: 400px; }
.chart-placeholder {
    color: var(--text-secondary);
    text-align: center;
    padding: 3rem 1rem;
}

/* ============================================
   Empty state placeholder with animated dots
   ============================================ */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    gap: 1.5rem;
    min-height: 400px;
}
.empty-state-animation {
    position: relative;
    width: 100%;
    max-width: 400px;
    height: 280px;
}
.empty-state-dot {
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    opacity: 0.6;
}
.empty-state-dot:nth-child(1) { left: 15%; top: 20%; animation: dotPulse 3s ease-in-out infinite 0s; }
.empty-state-dot:nth-child(2) { left: 78%; top: 12%; animation: dotPulse 3s ease-in-out infinite 0.4s; }
.empty-state-dot:nth-child(3) { left: 48%; top: 45%; animation: dotPulse 3s ease-in-out infinite 0.8s; background: var(--accent); }
.empty-state-dot:nth-child(4) { left: 12%; top: 75%; animation: dotPulse 3s ease-in-out infinite 1.2s; }
.empty-state-dot:nth-child(5) { left: 82%; top: 60%; animation: dotPulse 3s ease-in-out infinite 1.6s; }
.empty-state-dot:nth-child(6) { left: 42%; top: 85%; animation: dotPulse 3s ease-in-out infinite 2s; }
.empty-state-dot:nth-child(7) { left: 65%; top: 30%; animation: dotPulse 3s ease-in-out infinite 1s; background: var(--primary-light); }
.empty-state-dot:nth-child(8) { left: 28%; top: 55%; animation: dotPulse 3s ease-in-out infinite 1.8s; }

.empty-state-line {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transform-origin: left center;
    opacity: 0;
    border-radius: 1px;
}
/* Lines connecting dots */
.empty-state-line:nth-child(9) {
    left: 16%; top: 21%;
    width: 34%; transform: rotate(12deg);
    animation: lineAppear 4s ease-in-out infinite 0.5s;
}
.empty-state-line:nth-child(10) {
    left: 49%; top: 46%;
    width: 35%; transform: rotate(25deg);
    animation: lineAppear 4s ease-in-out infinite 1.5s;
}
.empty-state-line:nth-child(11) {
    left: 13%; top: 76%;
    width: 30%; transform: rotate(-35deg);
    animation: lineAppear 4s ease-in-out infinite 2.5s;
}
.empty-state-line:nth-child(12) {
    left: 66%; top: 31%;
    width: 18%; transform: rotate(70deg);
    animation: lineAppear 4s ease-in-out infinite 3s;
}
.empty-state-line:nth-child(13) {
    left: 29%; top: 56%;
    width: 22%; transform: rotate(-20deg);
    animation: lineAppear 4s ease-in-out infinite 0s;
}
.empty-state-line:nth-child(14) {
    left: 43%; top: 86%;
    width: 40%; transform: rotate(-30deg);
    animation: lineAppear 4s ease-in-out infinite 2s;
}

@keyframes dotPulse {
    0%, 100% { transform: scale(1); opacity: 0.5; }
    50% { transform: scale(1.3); opacity: 0.9; }
}

@keyframes lineAppear {
    0%, 100% { opacity: 0; }
    30%, 70% { opacity: 0.4; }
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-align: center;
    max-width: 280px;
    line-height: 1.5;
}

/* ============================================
   Table control blocks
   ============================================ */
.table-controls-group + .table-controls-group {
    margin-top: 0.75rem;
}
.table-controls-group .undo-bar {
    margin-top: 0.35rem;
}
.table-control-block {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

/* ============================================
   Column conversion controls
   ============================================ */
.convert-row {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}
.convert-row .form-group {
    margin-bottom: 0;
    min-width: 160px;
}
.convert-row .form-select {
    width: auto;
    min-width: 150px;
}

.undo-bar {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.undo-bar.active {
    display: flex;
}

/* ============================================
   Percentile filter block
   ============================================ */
.pct-filter-block {
    padding: 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.pct-filter-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.pct-status {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    letter-spacing: 0.02em;
}
.pct-status--inactive {
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.pct-status--active {
    background: rgba(52, 211, 153, 0.15);
    border: 1px solid var(--accent);
    color: var(--accent);
}
.pct-filter-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.pct-type-btns {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}
.pct-type-select-btn {
    font-size: 0.72rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s;
}
.pct-type-select-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(96, 165, 250, 0.1);
    text-decoration: none;
}
.pct-col-count {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}
.pct-filter-block .chip .col-type-badge {
    margin-left: 0.35rem;
    font-size: 0.55rem;
}
.pct-filter-params {
    display: flex;
    gap: 0.75rem;
    align-items: end;
    flex-wrap: wrap;
}
.pct-filter-params .toggle-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}
.pct-filter-params .toggle-label input[type="checkbox"] {
    accent-color: var(--primary);
    width: 14px;
    height: 14px;
    cursor: pointer;
}

#pctFilterBar.active {
    flex-direction: column;
    align-items: stretch;
    gap: 0.25rem;
}
.pct-bar-main {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.pct-skipped-notice {
    border-top: 1px solid var(--border-color);
    padding-top: 0.35rem;
    margin-top: 0.1rem;
}
.pct-skipped-toggle {
    cursor: pointer;
    color: #ef4444;
    font-size: 0.78rem;
    user-select: none;
}
.pct-skipped-toggle:hover {
    color: #dc2626;
}
.pct-skipped-list {
    margin: 0.3rem 0 0 0;
    padding-left: 1.2rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    list-style: disc;
}
.pct-skipped-list li {
    margin-bottom: 0.15rem;
}
.pct-skipped-list strong {
    color: #ef4444;
}

/* ============================================
   Outlier Detection block (tabbed)
   ============================================ */
.outlier-block {
    padding: 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.outlier-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.outlier-method-tabs {
    display: flex;
    gap: 0;
    border-bottom: 2px solid var(--border-color);
}
.outlier-method-tab {
    padding: 0.4rem 1rem;
    font-size: 0.8rem;
    font-weight: 600;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    transition: all 0.15s;
}
.outlier-method-tab:hover {
    color: var(--text-primary);
}
.outlier-method-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}
.outlier-panel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.iqr-section {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.iqr-section .chip-grid {
    max-height: 120px;
    overflow-y: auto;
}
.outlier-block .chip .col-type-badge {
    margin-left: 0.35rem;
    font-size: 0.55rem;
}

/* Feature toolbar styles moved to components.css */

/* ============================================
   Distribution stats panel
   ============================================ */
.dist-layout {
    display: flex;
    gap: 1rem;
}
.dist-chart-wrapper {
    flex: 1;
    min-width: 0;
}
.dist-stats-panel {
    width: 200px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.dist-stat-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
}
.dist-stat-label {
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
}
.dist-stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Regression stats box
   ============================================ */
.regression-stats-box {
    display: flex;
    gap: 1.5rem;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.8rem;
    flex-wrap: wrap;
}
.regression-stat {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
}
.regression-stat-label {
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.7rem;
    letter-spacing: 0.03em;
}
.regression-stat-value {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ============================================
   Responsive dashboard
   ============================================ */
@media (max-width: 900px) {
    .kpi-summary-bar {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.5rem 1rem;
    }
    .kpi-summary-separator {
        display: none;
    }
    .dist-layout {
        flex-direction: column;
    }
    .dist-stats-panel {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
    }
    .dist-stat-item {
        flex: 1 1 calc(50% - 0.5rem);
    }
}

/* Outlier method info notes */
.outlier-method-note {
    font-size: 0.78rem;
    opacity: 0.6;
    margin: 0.25rem 0 0.5rem;
    font-style: italic;
}

/* Manual filter cumulative conditions */
.manual-conditions-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.5rem;
}
.manual-conditions-list:empty {
    display: none;
}
.manual-condition-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius);
    background: rgba(244, 114, 182, 0.12);
    color: #f472b6;
    font-size: 0.8rem;
    font-family: var(--font-mono, monospace);
}
.manual-condition-remove {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0 0.15rem;
    opacity: 0.7;
}
.manual-condition-remove:hover {
    opacity: 1;
}

/* IQR check preview highlight */
.td-outlier {
    background: rgba(239, 68, 68, 0.18) !important;
    color: #fca5a5;
}

/* IQR check visualization chart */
.iqr-viz-chart {
    min-height: 450px;
}
.iqr-viz-alerts {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    border-top: 1px solid var(--border-color);
    font-size: 0.82rem;
    color: #fbbf24;
}

/* Inline button group (e.g. Check + Apply side by side) */
.btn-group-inline {
    display: flex;
    gap: 0.5rem;
}

/* Pipeline bar */
.pipeline-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.75rem;
    background: var(--bg-body);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.8rem;
}
.pipeline-bar-label {
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pipeline-bar-steps {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}
.pipeline-step {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 500;
}
.pipeline-step--conversions {
    background: rgba(250, 204, 21, 0.15);
    color: #eab308;
}
.pipeline-step--outlier {
    background: rgba(244, 114, 182, 0.15);
    color: #ec4899;
}
.pipeline-step--missing {
    background: rgba(251, 146, 60, 0.15);
    color: #f97316;
}
.pipeline-step--inactive {
    background: var(--bg-secondary);
    color: var(--text-muted);
}
.pipeline-arrow {
    color: var(--text-muted);
    font-size: 0.7rem;
}

@media (max-width: 600px) {
    .kpi-summary-bar {
        position: static;
    }
    .dashboard-header {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }
}
