/* Client Data Pipelines Page Styling */

.pipelines-container {
    max-width: 1400px;
    margin: 40px auto;
    padding: 0 30px;
}

.pipelines-header {
    text-align: center;
    margin-bottom: 50px;
}

.pipelines-title {
    font-size: 2.5rem;
    color: #145392;
    font-weight: 700;
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title-icon {
    font-size: 2.5rem;
}

.pipelines-subtitle {
    font-size: 1.2rem;
    color: #666;
    margin: 0;
}

/* Alert Styling */
.pipeline-alert {
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 30px;
    border-left: 4px solid #dc3545;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Stats Cards */
.pipelines-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.stat-card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border-top: 4px solid #145392;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(20, 83, 146, 0.15);
}

.stat-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: #145392;
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-size: 0.95rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

/* View toggle: Table vs Cards */
.pipelines-view-toggle {
    display: flex;
    gap: 0;
    margin-bottom: 16px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    width: fit-content;
}

.pipelines-view-toggle button {
    padding: 10px 20px;
    border: 1px solid #dee2e6;
    background: #fff;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    color: #495057;
    transition: background 0.2s, color 0.2s;
}

.pipelines-view-toggle button:first-child {
    border-right: none;
}

.pipelines-view-toggle button.active {
    background: #145392;
    color: white;
    border-color: #145392;
}

.pipelines-view-toggle button:hover:not(.active) {
    background: #f8f9fa;
}

.pipelines-view-controls {
    margin-bottom: 12px;
}

.pipelines-view-hint {
    margin: 8px 0 0 0;
    font-size: 0.85rem;
    color: #6c757d;
}

/* Table Wrapper: horizontal scroll so columns don't get cramped */
.table-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow-x: auto;
    overflow-y: visible;
    margin-bottom: 40px;
    -webkit-overflow-scrolling: touch;
}

.table-wrapper::after {
    content: '';
    display: block;
    height: 0;
    clear: both;
}

/* Scroll hint when content overflows */
/* Table: min-width so it doesn't squash; columns stay readable */
.pipelines-table {
    width: 100%;
    min-width: 1100px;
    border-collapse: collapse;
    margin: 0;
}

.pipelines-table thead {
    background: linear-gradient(135deg, #145392 0%, #1a6bb8 100%);
}

.pipelines-table thead th {
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 18px 20px;
    text-align: left;
    border: none;
    white-space: nowrap;
    min-width: 100px;
}

/* Sticky first column so dag_id stays visible when scrolling */
.pipelines-table thead th:first-child,
.pipelines-table tbody td:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #1a6bb8;
    color: white;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.08);
}

.pipelines-table tbody td:first-child {
    background: white;
    color: #145392;
}

.pipelines-table tbody tr:hover td:first-child {
    background: #f0f9ff;
}

.pipelines-table tbody tr {
    border-bottom: 1px solid #e9ecef;
    transition: background 0.2s ease;
}

.pipelines-table tbody tr:hover {
    background-color: #f0f9ff;
}

.pipelines-table tbody tr:last-child {
    border-bottom: none;
}

.pipelines-table tbody td {
    padding: 16px 20px;
    color: #333;
    font-size: 0.95rem;
    vertical-align: middle;
    border: none;
    word-wrap: break-word;
    overflow-wrap: break-word;
    min-width: 100px;
}

.pipelines-table tbody td:last-child {
    min-width: 120px;
}

.pipelines-table tbody td:first-child {
    font-weight: 600;
    color: #145392;
    min-width: 140px;
}

/* File row summary cell: enough width so list stays readable */
.cell-file-row-summary {
    min-width: 320px;
    vertical-align: top;
}

.file-row-summary-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.file-row-summary-item {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    padding: 6px 10px;
    background: #f0f7ff;
    border-radius: 6px;
    border-left: 3px solid #1a6bb8;
    font-size: 0.9rem;
}

.file-row-summary-item .file-name {
    flex: 1;
    min-width: 0;
    color: #333;
    word-break: break-word;
}

.file-row-summary-item .row-diff-badge {
    flex-shrink: 0;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.85rem;
    background: #145392;
    color: white;
}

.file-row-summary-item .row-diff-badge:empty {
    display: none;
}

/* Card view: one pipeline per card, no cramped columns */
.pipelines-cards {
    display: none;
    margin-bottom: 40px;
}

.pipelines-cards.active {
    display: block;
}

.table-wrapper.pipelines-table-wrap {
    transition: opacity 0.2s;
}

.table-wrapper.pipelines-table-wrap.hidden {
    display: none;
}

.pipeline-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    margin-bottom: 20px;
    overflow: hidden;
    border-left: 4px solid #145392;
}

.pipeline-card-header {
    padding: 16px 20px;
    background: linear-gradient(135deg, #f0f7ff 0%, #e8f2fc 100%);
    font-weight: 600;
    font-size: 1.1rem;
    color: #145392;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.pipeline-card-header-title {
    flex: 1;
    min-width: 0;
}

.pipeline-card-header-link {
    color: inherit;
    text-decoration: none;
}

.pipeline-card-header-link:hover {
    text-decoration: underline;
}

.pipeline-card-header-state {
    font-size: 0.85rem;
    text-transform: capitalize;
    padding: 4px 10px;
    border-radius: 6px;
    background: #145392;
    color: white;
    font-weight: 500;
}

.pipeline-card-body {
    padding: 20px;
    display: grid;
    gap: 12px 24px;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.pipeline-card-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.pipeline-card-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    font-weight: 600;
}

.pipeline-card-value {
    font-size: 0.95rem;
    color: #333;
    word-wrap: break-word;
}

/* Card view: file row summary gets full width */
.pipeline-card-row.file-row-summary-row {
    grid-column: 1 / -1;
}

.pipeline-card-row .file-row-summary-list {
    margin-top: 4px;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.empty-icon {
    font-size: 5rem;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: #145392;
    font-size: 1.8rem;
    font-weight: 700;
    margin-bottom: 15px;
}

.empty-state p {
    color: #666;
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .pipelines-container {
        padding: 0 20px;
    }
    
    .table-wrapper {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .pipelines-title {
        font-size: 2rem;
        flex-direction: column;
        gap: 10px;
    }
    
    .pipelines-subtitle {
        font-size: 1rem;
    }
    
    .pipelines-stats {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    .pipelines-table {
        font-size: 0.85rem;
    }
    
    .pipelines-table thead th,
    .pipelines-table tbody td {
        padding: 12px 15px;
    }

    .pipelines-table thead th:first-child,
    .pipelines-table tbody td:first-child {
        position: static;
        box-shadow: none;
    }
    
    /* Stack table on mobile */
    .pipelines-table thead {
        display: none;
    }
    
    .pipelines-table tbody tr {
        display: block;
        margin-bottom: 15px;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        padding: 15px;
    }
    
    .pipelines-table tbody td {
        display: block;
        text-align: left;
        padding: 10px 0;
        border-bottom: 1px solid #f0f0f0;
    }
    
    .pipelines-table tbody td:last-child {
        border-bottom: none;
    }
    
    .pipelines-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #145392;
        display: block;
        margin-bottom: 5px;
        font-size: 0.85rem;
        text-transform: uppercase;
    }
}

