/* ============================================================
   RSS Reader — 10-foot TV UI  (1920×1080 Full HD)
   Design principles: titles only, 44px+ text, high contrast,
   auto-scrolling columns, minimal chrome
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    font-family: 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
    font-size: 20px;
    background: #080a10;
    color: #f0f4ff;
}

/* ── TV root ──────────────────────────────────────────────── */
.tv-root {
    display: flex;
    flex-direction: column;
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background: #080a10;
}

/* ── Top bar ──────────────────────────────────────────────── */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 86px;
    padding: 0 44px;
    background: #0d1020;
    border-bottom: 3px solid #1a3a6a;
    flex-shrink: 0;
}

.app-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #4fc3f7;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.clock {
    font-size: 1.7rem;
    font-weight: 300;
    color: #b0bec5;
    letter-spacing: .06em;
}

.top-bar-actions { display: flex; gap: 12px; }

.btn-add, .btn-manage {
    padding: 12px 28px;
    border: none;
    border-radius: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s;
    letter-spacing: .03em;
}
.btn-add { background: #1565c0; color: #fff; }
.btn-add:hover { background: #1e88e5; }
.btn-manage { background: #263238; color: #b0bec5; }
.btn-manage:hover { background: #37474f; color: #fff; }

/* ── Feed grid ────────────────────────────────────────────── */
.feed-grid {
    display: grid;
    flex: 1;
    gap: 0;
    min-height: 0;  /* allow flex child to shrink */
    overflow: hidden;
}

.feed-wrapper {
    position: relative;
    border-right: 2px solid #0d1320;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.feed-wrapper:last-child { border-right: none; }

.btn-remove {
    position: absolute;
    top: 10px;
    right: 12px;
    z-index: 10;
    background: #c62828cc;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: .85rem;
    cursor: pointer;
    font-weight: 600;
}
.btn-remove:hover { background: #e53935; }

/* ── Feed column ──────────────────────────────────────────── */
.feed-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #080a10;
}

/* ── Feed column header ───────────────────────────────────── */
.feed-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 74px;
    padding: 0 32px;
    background: #0d1020;
    border-bottom: 4px solid #1565c0;
    flex-shrink: 0;
}

.feed-title {
    font-size: 1.55rem;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80%;
    letter-spacing: .04em;
}

.feed-updated {
    font-size: .9rem;
    color: #9e9e9e;
    white-space: nowrap;
    font-weight: 500;
}

.feed-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.feed-nav-btn {
    background: #1a2340;
    border: 1px solid #253050;
    color: #90a8d0;
    border-radius: 6px;
    width: 38px;
    height: 38px;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s, color .15s;
    line-height: 1;
}
.feed-nav-btn:hover { background: #1e88e5; color: #fff; border-color: #1e88e5; }
.feed-nav-btn.paused { color: #4fc3f7; border-color: #4fc3f7; }

/* ── Featured item (top section) ─────────────────────────── */
.feed-featured {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 36px 36px 28px;
    gap: 16px;
    overflow: hidden;
    border-bottom: 2px solid #0d1320;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    transition: background .2s;
}
.feed-featured:hover { background: #0d1525; }

.feed-featured-index {
    font-size: .85rem;
    font-weight: 700;
    color: #4fc3f7;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.feed-featured-title {
    font-size: 1.9rem;
    font-weight: 700;
    color: #ffffff;
    line-height: 1.3;
}

.feed-featured-summary {
    font-size: 1.25rem;
    color: #c5cfe0;
    line-height: 1.7;
    flex: 1;
    overflow: hidden;
}

.feed-featured-date {
    font-size: .9rem;
    font-weight: 600;
    color: #adadad;
    letter-spacing: .04em;
    text-transform: uppercase;
    flex-shrink: 0;
}

/* ── Item list (bottom section — up to 5-item viewport) ───── */
.feed-list {
    flex-shrink: 0;
    max-height: 300px;  /* caps at 5 items × 60px; fewer items = shorter list */
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #060810;
    position: relative;
}

/* fade edges to hint at scroll */
.feed-list::before,
.feed-list::after {
    content: '';
    position: absolute;
    left: 0; right: 0;
    height: 36px;
    z-index: 2;
    pointer-events: none;
}
.feed-list::before { top: 0;    background: linear-gradient(to bottom, #060810, transparent); }
.feed-list::after  { bottom: 0; background: linear-gradient(to top,   #060810, transparent); }

.feed-list-item {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    height: 60px;
    padding: 0 28px;
    gap: 16px;
    border-bottom: 1px solid #0d1220;
    transition: background .3s;
    cursor: pointer;
}
.feed-list-item:hover:not(.feed-list-item--active) { background: #0a1428; }

.feed-list-item--active {
    background: #0d2040;
    border-left: 4px solid #1e88e5;
}

.feed-list-item:not(.feed-list-item--active) {
    border-left: 4px solid transparent;
}

.feed-list-num {
    font-size: .85rem;
    font-weight: 700;
    color: #4fc3f7;
    min-width: 24px;
    text-align: right;
    flex-shrink: 0;
    opacity: .7;
}

.feed-list-item--active .feed-list-num {
    opacity: 1;
}

.feed-list-title {
    font-size: .95rem;
    font-weight: 500;
    color: #7a8aaa;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.feed-list-item--active .feed-list-title {
    color: #e8f0ff;
    font-weight: 600;
}

/* ── Loading spinner ──────────────────────────────────────── */
.feed-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
    color: #9e9e9e;
    font-size: 1.1rem;
}

.spinner {
    width: 52px;
    height: 52px;
    border: 5px solid #1a2a4a;
    border-top-color: #4fc3f7;
    border-radius: 50%;
    animation: spin .9s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error state ──────────────────────────────────────────── */
.feed-error {
    padding: 28px 32px;
    color: #ef9a9a;
    font-size: 1rem;
    line-height: 1.6;
}
.feed-url { color: #757575; font-size: .8rem; margin-top: 10px; word-break: break-all; }

/* ── Empty state ──────────────────────────────────────────── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    gap: 24px;
    color: #9e9e9e;
}
.empty-icon { font-size: 5rem; }
.empty-state h2 { font-size: 2rem; color: #bdbdbd; font-weight: 300; }
.empty-state p { font-size: 1.1rem; color: #9e9e9e; }
.empty-state strong { color: #4fc3f7; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.72);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-box {
    background: #0d1020;
    border: 1px solid #1a3a6a;
    border-radius: 14px;
    width: 580px;
    box-shadow: 0 12px 60px rgba(0,0,0,.7);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 28px 18px;
    border-bottom: 1px solid #1a3a6a;
}
.modal-header h2 { font-size: 1.3rem; color: #e3f2fd; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    color: #9e9e9e;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}
.modal-close:hover { color: #fff; background: #1e2a3a; }

.modal-body { padding: 24px 28px; }

.form-group { margin-bottom: 20px; }
.form-group label {
    display: block;
    font-size: .8rem;
    color: #adadad;
    margin-bottom: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
}
.optional { font-weight: 400; text-transform: none; color: #757575; }

.form-input {
    width: 100%;
    padding: 13px 16px;
    background: #080a10;
    border: 1px solid #1a3a6a;
    border-radius: 8px;
    color: #f0f4ff;
    font-size: 1rem;
}
.form-input:focus { outline: none; border-color: #4fc3f7; box-shadow: 0 0 0 2px #4fc3f720; }

.form-error {
    background: #b71c1c22;
    border: 1px solid #c62828;
    border-radius: 8px;
    padding: 10px 14px;
    color: #ef9a9a;
    font-size: .9rem;
    margin-top: 10px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 28px 22px;
    border-top: 1px solid #1a3a6a;
}

.btn-primary, .btn-secondary {
    padding: 11px 26px;
    border: none;
    border-radius: 8px;
    font-size: .95rem;
    font-weight: 700;
    cursor: pointer;
    transition: background .18s;
    letter-spacing: .03em;
}
.btn-primary { background: #1565c0; color: #fff; }
.btn-primary:hover:not(:disabled) { background: #1e88e5; }
.btn-primary:disabled { opacity: .35; cursor: default; }
.btn-secondary { background: #1a2030; color: #adadad; }
.btn-secondary:hover { background: #263040; color: #ffffff; }

/* ── Blazor error UI ──────────────────────────────────────── */
#blazor-error-ui {
    background: #b32121;
    color: white;
    padding: 10px 20px;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    display: none;
    font-size: .9rem;
    z-index: 9999;
}
#blazor-error-ui .reload { color: #ffe57f; margin-left: 10px; }
#blazor-error-ui .dismiss { float: right; cursor: pointer; }