/* ================================================================
   Feed Status — Page-specific styles
   Shared styles are in ../shared.css
   ================================================================ */

/* ── Summary stats (feeds-specific) ───────────────────────────── */
.summary-stats {
    display: flex; gap: 24px; flex-wrap: wrap; margin-bottom: 16px; align-items: center;
}
.summary-stat {
    font-size: 13px; color: var(--slate); display: flex; align-items: center; gap: 6px;
}
.summary-stat strong { font-size: 18px; font-weight: 700; }
.summary-stat.dot-healthy     strong { color: var(--jade); }
.summary-stat.dot-in-progress strong { color: var(--amber); }
.summary-stat.dot-attention   strong { color: var(--error-1); }
.summary-stat.dot-no-data     strong { color: var(--slate); }

.bar-seg { height: 100%; min-width: 2px; transition: width 0.3s; }
.bar-healthy     { background: var(--jade); }
.bar-in-progress { background: var(--amber); }
.bar-attention   { background: var(--error-1); }
.bar-no-data     { background: var(--smoke); }

/* ── Status chip dots ──────────────────────────────────────────── */
.chip-dot.dot-healthy     { background: var(--jade); }
.chip-dot.dot-in-progress { background: var(--amber); }
.chip-dot.dot-attention   { background: var(--error-1); }
.chip-dot.dot-no-data     { background: var(--slate); }

/* ── Feed cards ────────────────────────────────────────────────── */
.feed-list { display: flex; flex-direction: column; gap: 10px; }

.feed-card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
    transition: box-shadow 0.15s;
}
.feed-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }

.feed-row {
    display: flex; align-items: center; gap: 14px;
    padding: 14px 20px; cursor: pointer;
}

/* Aggregate status dot */
.agg-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.agg-healthy     { background: var(--jade); }
.agg-in-progress { background: var(--amber); }
.agg-attention   { background: var(--error-1); }
.agg-no-data     { background: var(--slate); }

.feed-name {
    flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px;
}
.feed-client {
    font-weight: 500; font-size: 14px; color: var(--charcoal);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-meta {
    font-size: 12px; color: var(--slate); font-weight: 300;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.feed-id {
    font-size: 11px; color: var(--slate); font-weight: 500;
    white-space: nowrap; flex-shrink: 0;
}

/* Component ratio bars */
.component-bars { display: flex; gap: 6px; flex-shrink: 0; }
.comp-bar { display: flex; align-items: center; gap: 4px; cursor: default; }
.comp-bar-label {
    font-size: 10px; font-weight: 700; color: var(--slate);
    width: 12px; text-align: center; flex-shrink: 0;
}
.comp-bar-track {
    width: 40px; height: 14px; border-radius: 3px;
    display: flex; overflow: hidden;
    background: var(--ash); border: 1px solid #e2e8f0;
}
.cb-seg         { height: 100%; min-width: 2px; }
.cb-healthy     { background: var(--jade); }
.cb-in-progress { background: var(--amber); }
.cb-attention   { background: var(--error-1); }
.cb-no-data     { background: var(--smoke); }

/* Aggregate badge */
.agg-badge { font-size: 10px; font-weight: 700; padding: 3px 10px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.agg-badge-healthy     { background: var(--jade-light); color: var(--jade-dark); }
.agg-badge-in-progress { background: var(--amber-light); color: var(--amber-dark); }
.agg-badge-attention   { background: var(--error-2); color: #881717; }
.agg-badge-no-data     { background: var(--ash); color: var(--slate); }

.expand-chevron { color: var(--slate); font-size: 12px; transition: transform 0.2s; flex-shrink: 0; }
.feed-card.expanded .expand-chevron { transform: rotate(180deg); }

/* ── Expanded details ──────────────────────────────────────────── */
.feed-details { display: none; border-top: 1px solid #f1f5f9; padding: 0 20px 20px; }
.feed-card.expanded .feed-details { display: block; }

.detail-section { margin-top: 16px; }
.detail-section-title {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    color: var(--royal); letter-spacing: 0.5px;
    margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.section-count { font-weight: 400; color: var(--slate); }

/* Pipeline rows inside expanded card */
.pipeline-grid { display: flex; flex-direction: column; gap: 6px; }
.pipe-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px; background: #f8fafc;
    border-radius: 6px; font-size: 13px; transition: background 0.1s;
}
.pipe-row:hover { background: #f1f5f9; }

.run-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.run-dot.run-success { background: var(--jade); }
.run-dot.run-failed  { background: var(--error-1); }
.run-dot.run-running { background: var(--amber); }
.run-dot.run-waiting { background: var(--slate); }

.pipe-name {
    flex: 1; min-width: 0;
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px; color: var(--charcoal);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pipeline-feedtype-label { font-weight: 400; color: var(--slate); }
.run-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.rb-success { background: var(--jade-light); color: var(--jade-dark); }
.rb-failed  { background: var(--error-2); color: #881717; }
.rb-running { background: var(--amber-light); color: var(--amber-dark); }
.rb-waiting { background: var(--ash); color: var(--slate); }

.sla-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; white-space: nowrap; flex-shrink: 0; }
.sla-on-time { background: var(--jade-light); color: var(--jade-dark); }
.sla-late    { background: var(--error-2); color: #881717; }
.sla-waiting { background: var(--ash); color: var(--slate); }

.pipe-time {
    font-size: 12px; color: var(--slate);
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; white-space: nowrap; flex-shrink: 0;
}
.pipe-duration { font-size: 12px; color: var(--slate); font-weight: 500; white-space: nowrap; flex-shrink: 0; min-width: 50px; text-align: right; }

.pipe-info {
    position: relative; cursor: pointer; flex-shrink: 0;
    font-size: 10px; font-weight: 600; color: var(--indigo);
    border: 1px solid #c0c9ff; background: var(--mist);
    border-radius: 4px; padding: 1px 6px;
}
.pipe-info:hover { background: #dde3ff; }
.pipe-tooltip {
    display: none; position: absolute; bottom: calc(100% + 6px); right: 0;
    background: var(--navy); color: #e2e8f0;
    padding: 10px 14px; border-radius: 8px;
    font-size: 11px; font-weight: 400; line-height: 1.7;
    white-space: nowrap; z-index: 100; min-width: 260px;
    pointer-events: none; text-transform: none;
}
.pipe-info:hover .pipe-tooltip { display: block; }
.pipe-tooltip .tt-label { color: var(--smoke); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; }
.pipe-tooltip .tt-value { color: var(--ash); font-weight: 500; }

.pipe-link {
    font-size: 11px; color: var(--indigo); text-decoration: none; flex-shrink: 0;
    padding: 1px 6px; border-radius: 4px; transition: background 0.15s; white-space: nowrap;
}
.pipe-link:hover { background: var(--mist); }

/* Availability grid inside expanded card */
.avail-grid { display: flex; flex-direction: column; gap: 0; border: 1px solid #e2e8f0; border-radius: 8px; overflow: hidden; }
.avail-grid-header {
    display: grid; grid-template-columns: 2fr 80px 170px 90px 80px 80px;
    gap: 10px; padding: 8px 12px;
    font-size: 10px; font-weight: 600; text-transform: uppercase;
    color: var(--slate); letter-spacing: 0.5px;
    background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.avail-row {
    display: grid; grid-template-columns: 2fr 80px 170px 90px 80px 80px;
    gap: 10px; padding: 8px 12px; font-size: 13px;
    align-items: center; border-bottom: 1px solid #f8fafc; transition: background 0.1s;
}
.avail-row:last-child { border-bottom: none; }
.avail-row:hover { background: #f8fafc; }

.avail-table {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 12px; color: var(--charcoal);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avail-schema { color: var(--slate); font-weight: 400; }
.avail-badge  { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px; text-align: center; white-space: nowrap; }
.badge-fresh   { background: #EDF6F0; color: #006644; }
.badge-waiting { background: #EDF6F0; color: #3d7a52; }
.badge-stale   { background: var(--error-2); color: #881717; }
.badge-missing { background: var(--ash); color: #5a6e78; }
.avail-time { font-size: 12px; color: var(--slate); font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; }
.avail-age  { font-size: 12px; font-weight: 600; }
.avail-fresh   .avail-age { color: var(--jade); }
.avail-waiting .avail-age { color: #77BB93; }
.avail-stale   .avail-age { color: var(--error-1); }
.avail-missing .avail-age { color: var(--slate); font-style: italic; }
.avail-records { font-size: 12px; color: var(--slate); text-align: right; }
.avail-sla     { font-size: 12px; color: var(--slate); font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace; }

.no-components { text-align: center; padding: 24px; color: var(--slate); font-size: 13px; font-style: italic; }

/* ── Debug footer ──────────────────────────────────────────────── */
.debug-footer {
    display: none; flex-wrap: wrap; gap: 4px 12px;
    padding: 14px 4px 6px;
    font-size: 11px; color: var(--slate);
    border-top: 1px solid #e8edf2;
    margin-top: 16px;
}
.debug-footer.visible { display: flex; }
.debug-sep { color: #d0d8de; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1000px) {
    .avail-grid-header, .avail-row { grid-template-columns: 2fr 70px 140px 80px; }
    .avail-grid-header > :nth-child(5),
    .avail-grid-header > :nth-child(6),
    .avail-row > :nth-child(5),
    .avail-row > :nth-child(6) { display: none; }
}
@media (max-width: 700px) {
    .controls-row { flex-direction: column; }
    .feed-row { flex-wrap: wrap; gap: 8px; }
    .feed-name { flex: 1 1 100%; }
    .pipe-row { flex-wrap: wrap; gap: 6px; }
    .pipe-name { flex: 1 1 100%; min-width: 0; }
    .avail-grid-header, .avail-row { grid-template-columns: 1fr 70px 80px; }
    .avail-grid-header > :nth-child(3),
    .avail-grid-header > :nth-child(4),
    .avail-grid-header > :nth-child(5),
    .avail-grid-header > :nth-child(6),
    .avail-row > :nth-child(3),
    .avail-row > :nth-child(4),
    .avail-row > :nth-child(5),
    .avail-row > :nth-child(6) { display: none; }
}

/* ================================================================
   DARK THEME — Feed Status
   ================================================================ */
html[data-theme="dark"] .feed-card {
    border: 1px solid var(--dark-border);
    box-shadow: 0 1px 3px rgba(0,0,0,0.4);
}
html[data-theme="dark"] .feed-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,0.55); }

html[data-theme="dark"] .comp-bar-track { border-color: var(--dark-border); }
html[data-theme="dark"] .detail-section-title { color: var(--accent-text); }
html[data-theme="dark"] .feed-details { border-top-color: var(--dark-border-soft); }

/* Aggregate / run / SLA badges (jade & amber tints flip via tokens) */
html[data-theme="dark"] .agg-badge-attention,
html[data-theme="dark"] .rb-failed,
html[data-theme="dark"] .sla-late { color: #FCA5A5; }
html[data-theme="dark"] .agg-badge-no-data,
html[data-theme="dark"] .rb-waiting,
html[data-theme="dark"] .sla-waiting { background: var(--dark-surface-3); }

/* Pipeline rows inside expanded card */
html[data-theme="dark"] .pipe-row { background: var(--dark-surface-2); }
html[data-theme="dark"] .pipe-row:hover { background: var(--dark-surface-3); }

/* Pipeline info pill + tooltip */
html[data-theme="dark"] .pipe-info {
    color: var(--accent-text); border-color: #3A4478; background: var(--mist);
}
html[data-theme="dark"] .pipe-info:hover { background: #2E3658; }
html[data-theme="dark"] .pipe-tooltip { border: 1px solid var(--dark-border); }
html[data-theme="dark"] .pipe-tooltip .tt-value { color: var(--charcoal); }
html[data-theme="dark"] .pipe-link { color: var(--accent-text); }

/* Availability grid */
html[data-theme="dark"] .avail-grid { border-color: var(--dark-border); }
html[data-theme="dark"] .avail-grid-header {
    background: var(--dark-surface-2); border-bottom-color: var(--dark-border);
}
html[data-theme="dark"] .avail-row { border-bottom-color: var(--dark-border-soft); }
html[data-theme="dark"] .avail-row:hover { background: var(--dark-surface-2); }
html[data-theme="dark"] .badge-fresh   { background: var(--jade-light); color: #5FE3A9; }
html[data-theme="dark"] .badge-waiting { background: var(--jade-light); color: #86C9A4; }
html[data-theme="dark"] .badge-stale   { color: #FCA5A5; }
html[data-theme="dark"] .badge-missing { background: var(--dark-surface-3); color: var(--slate); }
html[data-theme="dark"] .avail-fresh .avail-age { color: #34D399; }

/* Debug footer */
html[data-theme="dark"] .debug-footer { border-top-color: var(--dark-border); }
html[data-theme="dark"] .debug-sep { color: var(--smoke); }
