/* reddit-injected.css — Realtime UI (formerly injected by reddit.js) */
:root {
    --green: #10B981;
    --red:   #EF4444;
}
@keyframes toastIn   { from { opacity:0; transform:translateX(14px); } to { opacity:1; transform:translateX(0); } }
@keyframes toastOut  { from { opacity:1; } to { opacity:0; transform:translateX(14px); } }
@keyframes slideDown { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:translateY(0); } }
@keyframes pulseDot  { 0%,100% { opacity:1; transform:scale(1); } 50% { opacity:0.4; transform:scale(0.7); } }
@keyframes scanline  { 0% { transform:translateY(-100%); } 100% { transform:translateY(400%); } }
@keyframes fadeIn    { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }
@keyframes archxSpin { to { transform: rotate(360deg); } }

.archx-spin { display:inline-block; animation: archxSpin 0.75s linear infinite; }

/* ── Pipeline Expired Modal ── */
.archx-expired-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    z-index: 100000;
    display: none;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.25s ease;
}
.archx-expired-overlay.visible { display: flex; }

.archx-expired-modal {
    background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 20px;
    padding: 2rem;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    animation: slideDown 0.3s ease;
}

.archx-expired-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1.25rem;
    background: rgba(239, 68, 68, 0.15);
    border: 2px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

.archx-expired-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: #f87171;
    text-align: center;
    margin-bottom: 0.75rem;
    font-family: 'Inter', sans-serif;
}

.archx-expired-message {
    font-size: 0.95rem;
    color: #cbd5e1;
    text-align: center;
    line-height: 1.6;
    margin-bottom: 1.75rem;
    font-family: 'Inter', sans-serif;
}

.archx-expired-actions {
    display: flex;
    gap: 0.75rem;
    flex-direction: column;
}

.archx-expired-btn {
    padding: 0.85rem 1.5rem;
    border-radius: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.archx-expired-btn-primary {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    box-shadow: 0 4px 16px rgba(239, 68, 68, 0.3);
}

.archx-expired-btn-primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.archx-expired-btn-secondary {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #94a3b8;
}

.archx-expired-btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: #e2e8f0;
}

/* ── Offline banner ── */
#archxOfflineBanner {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 99999;
    background: linear-gradient(90deg, #7f1d1d, #991b1b);
    color: #fca5a5;
    font-size: 0.83rem;
    font-family: 'Inter', sans-serif;
    padding: 0.55rem 1.2rem;
    gap: 0.7rem;
    align-items: center;
    box-shadow: 0 2px 12px rgba(0,0,0,0.5);
    animation: slideDown 0.25s ease;
}
#archxOfflineBanner.visible { display: flex; }
#archxOfflineBanner strong  { color: #fef2f2; }
#archxOfflineCountdown { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: #fef2f2; }

/* ── Video queue banner ── */
.queue-banner {
    display: none;
    align-items: center;
    gap: 0.6rem;
    background: rgba(245,158,11,0.1);
    border: 1px solid rgba(245,158,11,0.3);
    border-radius: 12px;
    padding: 0.6rem 1rem;
    font-size: 0.82rem;
    color: #fbbf24;
    margin-bottom: 1rem;
}
.queue-banner.visible { display: flex; }

/* ── Script estimator box ── */
#archxScriptEstimate {
    display: none;
    margin-top: 0.75rem;
    background: rgba(99,102,241,0.07);
    border: 1px solid rgba(99,102,241,0.22);
    border-radius: 14px;
    padding: 0.9rem 1.1rem;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    animation: fadeIn 0.25s ease;
}
#archxScriptEstimate table { width: 100%; border-collapse: collapse; }
#archxScriptEstimate thead tr { border-bottom: 1px solid rgba(99,102,241,0.15); }
#archxScriptEstimate th {
    text-align: left; padding: 0.2rem 0.7rem 0.35rem 0;
    font-size: 0.65rem; color: #546180; font-weight: 600;
    text-transform: uppercase; letter-spacing: 0.06em;
}
#archxScriptEstimate th:last-child { text-align: right; padding-right: 0; }
#archxScriptEstimate td { padding: 0.28rem 0.7rem 0.28rem 0; font-variant-numeric: tabular-nums; }
#archxScriptEstimate td:last-child { text-align: right; padding-right: 0; }
#archxScriptEstimate tr.est-selected { background: rgba(99,102,241,0.12); border-radius: 6px; }
#archxScriptEstimate tr.est-selected td:first-child { font-weight: 700; color: #a5b4fc; }
.est-footer { margin-top: 0.55rem; font-size: 0.65rem; color: #374151; font-style: italic; }

/* ── Backend status bar ── */
#archxStatusBar { font-family:'Inter',sans-serif; }
.sb-wrap { display:flex; align-items:center; gap:1rem; padding:0.5rem 1rem; background:rgba(10,26,47,0.85); border:1px solid rgba(255,255,255,0.07); border-radius:12px; font-size:0.75rem; flex-wrap:wrap; }
.sb-label { color:#546180; font-weight:600; text-transform:uppercase; letter-spacing:0.06em; font-size:0.65rem; white-space:nowrap; }
.sb-group { display:flex; align-items:center; gap:0.45rem; }
.sb-name  { color:#94a3b8; font-size:0.72rem; white-space:nowrap; }
.sb-dots  { display:flex; gap:3px; align-items:center; }
.sb-dot   { width:8px; height:8px; border-radius:50%; flex-shrink:0; }
.sb-dot.free { background:#10B981; }
.sb-dot.busy { background:#374151; border:1px solid #4b5563; }
.sb-count { font-size:0.68rem; font-variant-numeric:tabular-nums; margin-left:2px; }
.sb-count.all-free  { color:#10B981; }
.sb-count.some-free { color:#f59e0b; }
.sb-count.all-busy  { color:#ef4444; }
.sb-divider { width:1px; height:14px; background:rgba(255,255,255,0.07); flex-shrink:0; }
.sb-ping { width:6px; height:6px; border-radius:50%; background:#10B981; flex-shrink:0; }
@keyframes sbPing { 0%,100%{opacity:1} 50%{opacity:0.3} }

/* ══════════════════════════════════════════════
   RESULT SECTION — full redesign v4.9
══════════════════════════════════════════════ */

.archx-result-card {
    background: #0a1220;
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 24px;
    overflow: hidden;
    margin-top: 2rem;
    animation: fadeIn 0.3s ease;
}

/* Video player sits flush inside the card at top */
.archx-result-video-wrap {
    position: relative;
    background: #000;
    line-height: 0;
}
.archx-result-video-wrap video {
    width: 100%;
    max-height: 420px;
    display: block;
    object-fit: contain;
}

/* Bottom action strip */
.archx-result-actions {
    padding: 1.25rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Header row: title badge + "create new" on the right */
.archx-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.archx-result-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f1f5f9;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.archx-result-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.2rem 0.65rem;
    border-radius: 30px;
    background: rgba(16,185,129,0.15);
    border: 1px solid rgba(16,185,129,0.3);
    color: #34d399;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.archx-result-new-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: #94a3b8;
    padding: 0.45rem 1rem;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    white-space: nowrap;
}
.archx-result-new-btn:hover { border-color: rgba(255,255,255,0.22); color: #e2e8f0; }

/* ── Download area ── */
.archx-dl-area {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 16px;
    padding: 1.1rem 1.25rem;
    font-family: 'Inter', sans-serif;
}

/* STATE: idle */
.archx-dl-idle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.archx-dl-idle-copy strong {
    display: block;
    font-size: 0.88rem;
    font-weight: 700;
    color: #e2e8f0;
    margin-bottom: 0.2rem;
}
.archx-dl-idle-copy span {
    font-size: 0.76rem;
    color: #546180;
}
.archx-dl-start-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    background: linear-gradient(135deg, #059669, #10b981);
    color: #fff;
    border: none;
    padding: 0.75rem 1.75rem;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    box-shadow: 0 4px 16px rgba(16,185,129,0.22);
    white-space: nowrap;
    flex-shrink: 0;
}
.archx-dl-start-btn:hover { opacity: 0.88; transform: translateY(-1px); }

/* STATE: downloading */
.archx-dl-progress { display: none; }
.archx-dl-progress.active { display: block; }

.archx-dl-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}
.archx-dl-progress-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #e2e8f0;
}
.archx-dl-pct {
    color: #10b981;
    font-variant-numeric: tabular-nums;
    min-width: 3ch;
}
.archx-dl-cancel-btn {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.3);
    color: #f87171;
    padding: 0.32rem 0.9rem;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.archx-dl-cancel-btn:hover { background: rgba(239,68,68,0.1); border-color: #f87171; }

.archx-dl-track {
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 99px;
    overflow: hidden;
    margin-bottom: 0.55rem;
}
.archx-dl-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4f46e5, #10b981);
    border-radius: 99px;
    transition: width 0.18s ease;
}
.archx-dl-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.74rem;
    color: #3f5070;
    font-variant-numeric: tabular-nums;
}

/* STATE: done */
.archx-dl-done { display: none; }
.archx-dl-done.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.archx-dl-done-msg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 700;
    color: #34d399;
}
.archx-dl-done-sub {
    font-size: 0.75rem;
    color: #546180;
    font-weight: 400;
    margin-left: 0.2rem;
}
.archx-dl-again-btn {
    background: transparent;
    border: 1px solid rgba(16,185,129,0.3);
    color: #34d399;
    padding: 0.42rem 1.1rem;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.archx-dl-again-btn:hover { background: rgba(16,185,129,0.1); }

/* STATE: error */
.archx-dl-error { display: none; }
.archx-dl-error.active {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
}
.archx-dl-error-msg {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #f87171;
}
.archx-dl-retry-btn {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.3);
    color: #f87171;
    padding: 0.42rem 1.1rem;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.archx-dl-retry-btn:hover { background: rgba(239,68,68,0.1); }

/* ── Stage cancel buttons ── */
.stage-cancel-btn {
    background: transparent;
    border: 1px solid rgba(239,68,68,0.25);
    color: #f87171;
    padding: 0.45rem 1.1rem;
    border-radius: 30px;
    font-family: 'Inter', sans-serif;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.stage-cancel-btn:hover { 
    background: rgba(239,68,68,0.1); 
    border-color: #f87171;
}
.stage-cancel-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
