/**
 * NZB Hunt - Standalone CSS
 * Independent module: does not share styles with Movie Hunt, Requestarr, or any other module.
 */

/* ── Section layout — match Discover (dark blue bg, same width) ─── */
#nzb-hunt-section,
#nzb-hunt-activity-section,
#nzb-hunt-settings-section,
#nzb-hunt-server-editor-section {
    background: linear-gradient(180deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.85) 100%);
}
#nzb-hunt-section {
    display: none;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
#nzb-hunt-section.active {
    display: block !important;
}

.nzb-hunt-container {
    width: 100%;
    padding: 24px 0 !important;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Give queue/history result area more vertical space */
#nzb-hunt-section .nzb-tab-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
#nzb-hunt-section .nzb-queue-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}
#nzb-hunt-section .nzb-queue-panel #nzb-queue-body,
#nzb-hunt-section .nzb-queue-panel #nzb-history-body {
    flex: 1;
    min-height: 420px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}
/* Scrollable table area — only the table scrolls, footer stays fixed at bottom */
#nzb-hunt-section .nzb-queue-panel .nzb-table-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: auto;
}
#nzb-hunt-section .nzb-queue-panel .nzb-queue-footer,
#nzb-hunt-section .nzb-queue-panel .nzb-history-footer {
    flex-shrink: 0;
}

/* ── Server Editor (full page) ───────────────────────────────────── */
#nzb-hunt-server-editor-section {
    display: none;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}
#nzb-hunt-server-editor-section.active {
    display: block !important;
}

/* NZB Hunt settings header — add padding-top so it doesn't touch the topbar */
.nzb-hunt-settings-header {
    padding-top: 16px;
}

/* Editor uses standard page-header-bar (reqset-toolbar) — extra tweaks */
.nzb-editor-toolbar {
    margin-top: 16px;
    margin-bottom: 24px;
}
.nzb-editor-toolbar .reqset-toolbar-right {
    gap: 12px;
}

/* Connection status pill in editor header */
.nzb-server-connection-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all 0.3s ease;
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border: 1px solid rgba(99, 102, 241, 0.2);
}
.nzb-server-connection-pill.pill-checking {
    background: rgba(99, 102, 241, 0.1);
    color: #a5b4fc;
    border-color: rgba(99, 102, 241, 0.2);
}
.nzb-server-connection-pill.pill-success {
    background: rgba(16, 185, 129, 0.08);
    color: #34d399;
    border-color: rgba(16, 185, 129, 0.22);
}
.nzb-server-connection-pill.pill-fail {
    background: rgba(239, 68, 68, 0.08);
    color: #f87171;
    border-color: rgba(239, 68, 68, 0.2);
}

/* Editor grid layout (2-column) */
.nzb-server-editor-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.nzb-editor-section {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 12px;
    overflow: hidden;
}
.nzb-editor-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    color: #e2e8f0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
    background: rgba(30, 41, 59, 0.3);
}
.nzb-editor-section-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.85rem;
}
.nzb-editor-icon-blue { background: rgba(99, 102, 241, 0.12); color: #a5b4fc; }
.nzb-editor-icon-green { background: rgba(16, 185, 129, 0.12); color: #6ee7b7; }
.nzb-editor-icon-amber { background: rgba(245, 158, 11, 0.12); color: #fbbf24; }
.nzb-editor-icon-purple { background: rgba(139, 92, 246, 0.12); color: #a78bfa; }
.nzb-editor-section-body {
    padding: 16px 18px;
}
.nzb-form-help {
    font-size: 0.78rem;
    color: #64748b;
    margin: 4px 0 0 0;
    line-height: 1.4;
}
.nzb-form-help strong { color: #94a3b8; }

/* ── Huntarr-style toggle (purple slide, no glow) ───────────────── */
.nzb-toggle-row-huntarr {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}
.nzb-toggle-row-huntarr > span:first-child {
    font-size: 0.9rem;
    font-weight: 500;
    color: #cbd5e1;
}
.nzb-toggle-row-huntarr input[type="checkbox"] {
    display: none;
}
.nzb-toggle-slider-huntarr {
    position: relative;
    width: 44px;
    height: 24px;
    background: #334155;
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 12px;
    transition: background 0.25s ease, border-color 0.25s ease;
    flex-shrink: 0;
    display: inline-block;
    cursor: pointer;
    vertical-align: middle;
}
.nzb-toggle-slider-huntarr::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #64748b;
    border-radius: 50%;
    transition: transform 0.25s ease, background 0.25s ease;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.nzb-toggle-row-huntarr input:checked + .nzb-toggle-slider-huntarr {
    background: #6366f1;
    border-color: #818cf8;
}
.nzb-toggle-row-huntarr input:checked + .nzb-toggle-slider-huntarr::after {
    transform: translateX(20px);
    background: #fff;
}

/* Inline test button */
.nzb-btn-test-inline {
    margin-top: 12px;
    font-size: 0.82rem !important;
    padding: 8px 14px !important;
    color: #64748b !important;
    border: 1px solid rgba(148, 163, 184, 0.12) !important;
    background: transparent !important;
}
.nzb-btn-test-inline:hover {
    background: rgba(99, 102, 241, 0.08) !important;
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.25) !important;
}

@media (max-width: 900px) {
    .nzb-server-editor-grid {
        grid-template-columns: 1fr;
    }
}

.nzb-btn-ghost {
    background: transparent !important;
    border-color: transparent !important;
    color: #94a3b8;
}
.nzb-btn-ghost:hover {
    background: rgba(148, 163, 184, 0.1) !important;
    color: #e2e8f0;
}

.nzb-priority-help {
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.5;
    max-width: none;
}

/* ── Status bar (metrics + actions) ─────────────────────────────── */
.nzb-status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 12px 18px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(71, 85, 105, 0.35);
    border-radius: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.nzb-status-metrics {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.nzb-status-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #94a3b8;
    font-size: 0.85rem;
    white-space: nowrap;
}

.nzb-status-item i:first-of-type {
    color: #64748b;
    font-size: 0.9rem;
    width: 16px;
    text-align: center;
}

.nzb-status-value {
    color: #f1f5f9;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.nzb-status-label {
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 500;
}

/* Connections: hover tooltip (per-server breakdown) */
.nzb-active-connections {
    position: relative;
    cursor: help;
}
.nzb-status-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    font-size: 0.82rem;
    color: #e2e8f0;
    line-height: 1.4;
    min-width: 220px;
    max-width: 420px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
.nzb-status-tooltip .nzb-tooltip-servers {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    margin-top: 6px;
}
.nzb-status-tooltip .nzb-tooltip-server {
    white-space: nowrap;
}
.nzb-active-connections:hover .nzb-status-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Status/error cell tooltip (queue status, history result) — hover to see full message */
#nzb-hunt-section .nzb-status-with-tooltip {
    position: relative;
    cursor: help;
    display: block;
}
#nzb-hunt-section .nzb-cell-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    font-size: 0.82rem;
    color: #e2e8f0;
    line-height: 1.4;
    min-width: 220px;
    max-width: 520px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s, visibility 0.15s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}
#nzb-hunt-section .nzb-status-with-tooltip:hover .nzb-cell-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Speed control compact */
.nzb-speed-chevron {
    font-size: 0.65rem !important;
    color: #64748b !important;
    margin-left: 2px;
}

.nzb-speed-control {
    position: relative;
    cursor: pointer;
    padding: 4px 6px;
    margin: -4px -6px;
    border-radius: 6px;
}
.nzb-speed-control:hover {
    background: rgba(99, 102, 241, 0.08);
}

/* Actions: Pause + Settings */
.nzb-status-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.nzb-btn-pause {
    width: 40px;
    height: 40px;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(99, 102, 241, 0.2) !important;
    border: 1px solid rgba(99, 102, 241, 0.4) !important;
    color: #a5b4fc !important;
}
.nzb-btn-pause:hover {
    background: rgba(99, 102, 241, 0.3) !important;
    border-color: rgba(99, 102, 241, 0.6) !important;
    color: #93c5fd !important;
}

.nzb-status-actions .nzb-display-prefs-btn {
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── NZB Hunt not configured as client (link to Media Hunt → Clients) ─── */
.nzb-client-warning {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 20px;
    margin-bottom: 20px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 12px;
    color: #94a3b8;
    font-size: 0.95rem;
    line-height: 1.5;
}
.nzb-client-warning i {
    flex-shrink: 0;
    font-size: 1.25rem;
    color: #a5b4fc;
    margin-top: 2px;
}
.nzb-client-warning-content {
    flex: 1;
}
.nzb-client-warning-content strong {
    color: #e2e8f0;
    font-weight: 600;
}
.nzb-client-warning-link {
    color: #a5b4fc;
    font-weight: 500;
    text-decoration: none;
    border-bottom: 1px solid rgba(96, 165, 250, 0.5);
    transition: color 0.15s, border-color 0.15s;
}
.nzb-client-warning-link:hover {
    color: #93c5fd;
    border-bottom-color: #a5b4fc;
}

/* ── Speed limit control ─────────────────────────────────────────── */
.nzb-speed-limit-badge {
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 8px;
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
    margin-left: 4px;
    white-space: nowrap;
}

.nzb-speed-popover {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    z-index: 100;
    background: rgba(15, 23, 42, 0.98);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 10px;
    padding: 12px;
    min-width: 200px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(12px);
}

.nzb-speed-popover-title {
    font-size: 0.75rem;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.nzb-speed-popover-options {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 8px;
}

.nzb-speed-opt {
    background: none;
    border: none;
    color: #cbd5e1;
    text-align: left;
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: background 0.15s;
}

.nzb-speed-opt:hover {
    background: rgba(99, 102, 241, 0.12);
    color: #fff;
}

.nzb-speed-opt.active {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    font-weight: 600;
}

.nzb-speed-popover-custom {
    display: flex;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.nzb-speed-popover-custom input {
    flex: 1;
    padding: 6px 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 6px;
    color: #f8fafc;
    font-size: 0.85rem;
    min-width: 0;
}

.nzb-speed-popover-custom input:focus {
    border-color: #6366f1;
    outline: none;
}

.nzb-speed-custom-btn {
    padding: 6px 12px !important;
    font-size: 0.8rem !important;
    white-space: nowrap;
}

/* ── Tabs (Queue / History / Warnings) ───────────────────────────── */
.nzb-tabs {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid rgba(90, 109, 137, 0.2);
}

.nzb-tab {
    padding: 12px 24px;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    position: relative;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nzb-tab:hover {
    color: #e2e8f0;
}

.nzb-tab.active {
    color: #6366f1;
}

.nzb-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #6366f1;
    border-radius: 1px;
}

.nzb-tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}

.nzb-tab-badge-default {
    background: rgba(99, 102, 241, 0.15);
    color: #a5b4fc;
}

.nzb-tab-badge-warning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.nzb-tab-badge-warn {
    background: rgba(245, 158, 11, 0.2);
    color: #fbbf24;
}

/* ── Warnings panel ──────────────────────────────────────────── */
.nzb-warnings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px;
}

.nzb-warning-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    border-left: 3px solid;
}

.nzb-warning-error {
    background: rgba(239, 68, 68, 0.06);
    border-left-color: #ef4444;
}
.nzb-warning-error .nzb-warning-icon { color: #ef4444; }

.nzb-warning-warning {
    background: rgba(245, 158, 11, 0.06);
    border-left-color: #f59e0b;
}
.nzb-warning-warning .nzb-warning-icon { color: #f59e0b; }

.nzb-warning-info {
    background: rgba(99, 102, 241, 0.06);
    border-left-color: #6366f1;
}
.nzb-warning-info .nzb-warning-icon { color: #6366f1; }

.nzb-warning-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    padding-top: 2px;
}

.nzb-warning-body {
    flex: 1;
    min-width: 0;
}

.nzb-warning-title {
    font-weight: 600;
    font-size: 0.88rem;
    color: #e2e8f0;
    margin-bottom: 4px;
}

.nzb-warning-msg {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.45;
}

.nzb-warning-time {
    font-size: 0.72rem;
    color: #64748b;
    margin-top: 6px;
}

.nzb-warning-dismiss {
    flex-shrink: 0;
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    padding: 4px;
    font-size: 0.85rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.nzb-warning-dismiss:hover {
    color: #e2e8f0;
    background: rgba(148, 163, 184, 0.1);
}

/* ── Queue panel ─────────────────────────────────────────────────── */
.nzb-queue-panel {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 12px;
    overflow: visible;
    min-height: 350px;
}

.nzb-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(90, 109, 137, 0.2);
}

.nzb-queue-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #f8fafc;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nzb-queue-title i {
    color: #6366f1;
}

.nzb-queue-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nzb-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(30, 41, 59, 0.5);
    color: #cbd5e1;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.nzb-btn:hover {
    background: rgba(51, 65, 85, 0.8);
    color: #fff;
    border-color: rgba(148, 163, 184, 0.4);
}

.nzb-btn-primary {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: #a5b4fc;
}

.nzb-btn-primary:hover {
    background: rgba(99, 102, 241, 0.25);
    border-color: rgba(99, 102, 241, 0.5);
    color: #93bbfd;
}

.nzb-btn:disabled,
.nzb-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: rgba(71, 85, 105, 0.3) !important;
    border-color: rgba(71, 85, 105, 0.4) !important;
    color: #64748b !important;
}
.nzb-btn-primary:disabled:hover {
    background: rgba(71, 85, 105, 0.3) !important;
    border-color: rgba(71, 85, 105, 0.4) !important;
    color: #64748b !important;
}

.nzb-btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #f87171;
}

.nzb-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

/* ── Queue empty state ───────────────────────────────────────────── */
.nzb-queue-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 24px;
    text-align: center;
}

.nzb-queue-empty-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.08);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.nzb-queue-empty-icon i {
    font-size: 2rem;
    color: #334155;
}

.nzb-queue-empty h3 {
    color: #f1f5f9;
    font-size: 1.15rem;
    margin: 0 0 8px;
}

.nzb-queue-empty p {
    color: #64748b;
    font-size: 0.9rem;
    margin: 0;
    max-width: 320px;
}

/* ── Queue item rows ─────────────────────────────────────────────── */
.nzb-queue-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s;
}

.nzb-queue-item:hover {
    background: rgba(99, 102, 241, 0.04);
}

.nzb-queue-item:last-child {
    border-bottom: none;
}

.nzb-queue-item-name {
    flex: 1;
    color: #e2e8f0;
    font-size: 0.9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nzb-queue-item-size {
    color: #94a3b8;
    font-size: 0.85rem;
    white-space: nowrap;
}

.nzb-queue-item-progress {
    width: 120px;
    height: 6px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 3px;
    overflow: hidden;
    flex-shrink: 0;
}

.nzb-queue-item-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #6366f1, #a5b4fc);
    border-radius: 3px;
    transition: width 0.3s;
}

.nzb-queue-item-status {
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.nzb-queue-item-status.downloading {
    color: #6366f1;
}

.nzb-queue-item-status.paused {
    color: #f59e0b;
}

.nzb-queue-item-status.queued {
    color: #94a3b8;
}

/* ── Coming Soon placeholder ─────────────────────────────────────── */
.nzb-coming-soon {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 120px 24px;
    text-align: center;
}

.nzb-coming-soon-icon {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1), rgba(99, 102, 241, 0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.08);
}

.nzb-coming-soon-icon i {
    font-size: 2.5rem;
    color: #6366f1;
}

.nzb-coming-soon h2 {
    color: #f1f5f9;
    font-size: 1.5rem;
    margin: 0 0 12px;
    font-weight: 600;
}

.nzb-coming-soon p {
    color: #64748b;
    font-size: 1rem;
    margin: 0;
    max-width: 400px;
    line-height: 1.6;
}

.nzb-coming-soon-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 20px;
    padding: 6px 16px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
    font-size: 0.85rem;
    font-weight: 500;
}

/* ═════════════════════════════════════════════════════════════════
   SETTINGS  –  Folders & Servers
   ═════════════════════════════════════════════════════════════════ */

/* ── Settings section ────────────────────────────────────────────── */
#nzb-hunt-settings-section {
    display: none;
    width: 100%;
    min-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 15px var(--page-gap, 30px);
    margin: 0;
}
#nzb-hunt-settings-section.active {
    display: block !important;
}

/* ── Settings sub-nav tabs ───────────────────────────────────────── */
.nzb-settings-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 24px;
    border-bottom: 2px solid rgba(90, 109, 137, 0.2);
}

.nzb-settings-tab {
    padding: 12px 24px;
    color: #94a3b8;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    border: none;
    background: none;
    position: relative;
    transition: color 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.nzb-settings-tab:hover {
    color: #e2e8f0;
}

.nzb-settings-tab.active {
    color: #6366f1;
}

.nzb-settings-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #6366f1;
    border-radius: 1px;
}

/* ── Settings group panel ────────────────────────────────────────── */
.nzb-settings-group {
    background: rgba(15, 23, 42, 0.4);
    border: 1px solid rgba(148, 163, 184, 0.08);
    border-radius: 12px;
    padding: 24px;
}

.nzb-settings-group h3 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    font-weight: 600;
    color: #f8fafc;
    display: flex;
    align-items: center;
}

.nzb-settings-help {
    color: #94a3b8;
    font-size: 0.9rem;
    margin: 0 0 24px;
    line-height: 1.5;
}

.nzb-settings-footer {
    margin-top: 24px;
    display: flex;
    justify-content: flex-end;
}

/* ── Folder rows ─────────────────────────────────────────────────── */
.nzb-folder-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 16px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.08);
}

.nzb-folder-row:last-of-type {
    border-bottom: none;
}

.nzb-folder-label {
    flex: 0 0 220px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nzb-folder-title {
    font-size: 0.95rem;
    font-weight: 500;
    color: #e2e8f0;
}

.nzb-folder-desc {
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

.nzb-folder-input-group {
    flex: 1;
    display: flex;
    gap: 8px;
    align-items: center;
}

.nzb-folder-input {
    flex: 1;
    padding: 10px 14px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 8px;
    color: #f8fafc;
    font-size: 0.95rem;
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.nzb-folder-input:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.nzb-btn-browse {
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(148, 163, 184, 0.1);
    color: #e2e8f0;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
    white-space: nowrap;
}

.nzb-btn-browse:hover {
    background: rgba(148, 163, 184, 0.2);
    border-color: rgba(148, 163, 184, 0.4);
}

/* ── Advanced Settings (modernized card layout) ───────────────────── */
#nzb-hunt-settings-advanced .nzb-adv-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
    gap: 24px;
    align-items: start;
}

#nzb-hunt-settings-advanced .nzb-adv-card {
    background: rgba(30, 41, 59, 0.32);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(148, 163, 184, 0.07);
    border-radius: 16px;
    padding: 0;
    overflow: hidden;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#nzb-hunt-settings-advanced .nzb-adv-card:hover {
    border-color: rgba(148, 163, 184, 0.14);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

#nzb-hunt-settings-advanced .nzb-adv-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.07);
}

#nzb-hunt-settings-advanced .nzb-adv-card-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
}

#nzb-hunt-settings-advanced .nzb-adv-card-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 0.9rem;
    flex-shrink: 0;
}

#nzb-hunt-settings-advanced .nzb-adv-icon-amber {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}

#nzb-hunt-settings-advanced .nzb-adv-icon-blue {
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}

#nzb-hunt-settings-advanced .nzb-adv-icon-teal {
    background: rgba(20, 184, 166, 0.12);
    color: #2dd4bf;
}

#nzb-hunt-settings-advanced .nzb-adv-icon-purple {
    background: rgba(139, 92, 246, 0.12);
    color: #a78bfa;
}

#nzb-hunt-settings-advanced .nzb-adv-card-desc {
    margin: 0;
    padding: 18px 24px;
    color: #94a3b8;
    font-size: 0.9rem;
    line-height: 1.6;
}

#nzb-hunt-settings-advanced .nzb-adv-card-body {
    padding: 0 24px 24px;
}

#nzb-hunt-settings-advanced .nzb-adv-setting {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 26px;
}

#nzb-hunt-settings-advanced .nzb-adv-setting:last-child {
    margin-bottom: 0;
}

#nzb-hunt-settings-advanced .nzb-adv-setting-label {
    font-size: 0.95rem;
    font-weight: 500;
    color: #e2e8f0;
    margin: 0;
}

#nzb-hunt-settings-advanced .nzb-adv-setting-help {
    margin: 0;
    font-size: 0.85rem;
    color: #64748b;
    line-height: 1.6;
}

#nzb-hunt-settings-advanced .nzb-adv-setting-input {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

#nzb-hunt-settings-advanced .nzb-adv-size-hint {
    color: #64748b;
    font-size: 0.8rem;
    white-space: nowrap;
}

#nzb-hunt-settings-advanced .nzb-adv-setting-divider {
    height: 1px;
    background: rgba(71, 85, 105, 0.35);
    margin: 24px 0 16px;
    width: 100%;
}

#nzb-hunt-settings-advanced .nzb-adv-setting-group-title {
    font-size: 0.88rem;
    font-weight: 600;
    color: #94a3b8;
    margin: 0 0 16px;
    width: 100%;
}

/* ── Server cards  (reuses instance-card-grid from movie hunt) ──── */
#nzb-server-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 14px;
    margin-top: 8px;
}

/* Server guidance section */
.nzb-servers-guidance {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.nzb-servers-guidance-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.1);
    border-radius: 10px;
    flex: 1 1 0;
    min-width: 260px;
}
.nzb-servers-guidance-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.95rem;
    background: rgba(99, 102, 241, 0.12);
    color: #a5b4fc;
}
.nzb-servers-guidance-icon-tip {
    background: rgba(245, 158, 11, 0.12);
    color: #fbbf24;
}
.nzb-servers-guidance-body { flex: 1; min-width: 0; }
.nzb-servers-guidance-title {
    font-weight: 600;
    color: #e2e8f0;
    font-size: 0.9rem;
    margin-bottom: 4px;
}
.nzb-servers-guidance-text {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.5;
}
.nzb-servers-guidance-text strong { color: #cbd5e1; }

/* Server grid wrapper (replaces instance-card-grid for servers) */
.nzb-server-grid-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    margin-top: 8px;
}

.nzb-server-card {
    padding: 0;
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nzb-server-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border-color: rgba(99, 102, 241, 0.3);
}

.nzb-server-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    background: linear-gradient(135deg, rgba(30, 41, 59, 0.8) 0%, rgba(15, 23, 42, 0.6) 100%);
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.nzb-server-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
    font-weight: 600;
    color: #f8fafc;
    min-width: 0;
}

.nzb-server-card-name i {
    color: #6366f1;
    flex-shrink: 0;
}

.nzb-server-card-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nzb-server-card-badges {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.nzb-badge {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nzb-badge-priority {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.nzb-badge-enabled {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.nzb-badge-disabled {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

.nzb-badge-ssl {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.nzb-server-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 16px;
}

.nzb-server-detail {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.nzb-server-detail i {
    width: 16px;
    text-align: center;
    color: #475569;
}

.nzb-server-detail span {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #cbd5e1;
}

/* server status line */
.nzb-server-status-line {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
    padding: 4px 0;
}

/* bandwidth: 1h, 24h, 30d, total in compact grid + bar */
.nzb-server-bandwidth {
    margin-top: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(148, 163, 184, 0.1);
}

.nzb-server-bandwidth-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px 8px;
    font-size: 0.7rem;
}

.nzb-server-bandwidth .nzb-bw-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
}

.nzb-server-bandwidth .nzb-bw-label {
    color: #64748b;
    font-size: 0.65rem;
}

.nzb-server-bandwidth .nzb-bw-value {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #cbd5e1;
}

.nzb-server-bandwidth-bar {
    height: 5px;
    margin-top: 6px;
    background: rgba(148, 163, 184, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.nzb-server-bandwidth-fill {
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(90deg, #6366f1, #a5b4fc);
    transition: width 0.4s;
}

.nzb-server-card-footer {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.08);
}

.nzb-server-card-footer .nzb-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.8rem;
    padding: 10px 10px;
    border-radius: 0;
    border: none;
    border-right: 1px solid rgba(148, 163, 184, 0.08);
    background: rgba(30, 41, 59, 0.3);
    transition: background 0.15s;
}
.nzb-server-card-footer .nzb-btn:last-child {
    border-right: none;
}
.nzb-server-card-footer .nzb-btn:hover {
    background: rgba(99, 102, 241, 0.1);
}
.nzb-server-card-footer .nzb-btn.nzb-btn-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}
.nzb-server-card-footer-secondary {
    border-top: 1px solid rgba(148, 163, 184, 0.05) !important;
}
.nzb-server-card-footer-secondary .nzb-btn.nzb-btn-subtle {
    flex: 1;
    justify-content: center;
    font-size: 0.72rem;
    padding: 6px 10px;
    border-radius: 0 0 10px 10px;
    border: none;
    background: rgba(30, 41, 59, 0.15);
    color: #64748b;
    cursor: pointer;
    transition: all 0.15s;
}
.nzb-server-card-footer-secondary .nzb-btn.nzb-btn-subtle:hover {
    background: rgba(99, 102, 241, 0.08);
    color: #a5b4fc;
}

/* ── Add server card (matches instance-card-grid pattern) ────────── */
#nzb-add-server-card {
    min-height: 180px;
    border: 2px dashed rgba(148, 163, 184, 0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

#nzb-add-server-card:hover {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.04);
}

#nzb-add-server-card .add-icon {
    font-size: 2rem;
    color: #6366f1;
}

#nzb-add-server-card .add-text {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ═══════ Server Modal ═══════ */
.nzb-server-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
}

.nzb-server-modal[style*="display: flex"] {
    display: flex !important;
}

.nzb-server-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
}

.nzb-server-modal-content {
    position: relative;
    z-index: 1001;
    background: rgba(15, 23, 42, 0.98);
    border: 2px solid rgba(99, 102, 241, 0.35);
    border-radius: 12px;
    max-width: 520px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
}

.nzb-server-modal-header {
    position: relative;
    background: linear-gradient(135deg, #1e293b 0%, #334155 50%, #0f172a 100%);
    padding: 16px 24px 12px;
}

.nzb-server-modal-close {
    position: absolute;
    top: 8px;
    right: 8px;
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.nzb-server-modal-close i {
    pointer-events: none;
}

.nzb-server-modal-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.nzb-server-modal-header-overlay {
    position: relative;
    z-index: 2;
    padding-right: 52px;
}

.nzb-server-modal-header-overlay h2 {
    font-size: 1.15rem;
    font-weight: 600;
    color: #f8fafc;
    margin: 0;
}

.nzb-server-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.nzb-form-group {
    margin-bottom: 16px;
}

.nzb-form-group label {
    display: block;
    font-size: 0.9rem;
    font-weight: 500;
    color: #e2e8f0;
    margin-bottom: 6px;
}

.nzb-form-group input[type="text"],
.nzb-form-group input[type="password"],
.nzb-form-group input[type="number"] {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #475569;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.95rem;
    box-sizing: border-box;
}

.nzb-form-group input:focus {
    border-color: #6366f1;
    outline: none;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.15);
}

.nzb-form-hint {
    display: block;
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 4px;
}

.nzb-form-row {
    display: flex;
    gap: 12px;
}

/* Toggle switch – redesigned with red/green states */
.nzb-toggle-row {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    user-select: none;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
}

.nzb-toggle-row > span:first-child {
    font-size: 0.9rem;
    font-weight: 500;
    color: #cbd5e1;
    letter-spacing: 0.3px;
}

.nzb-toggle-row input[type="checkbox"] {
    display: none;
}


/* New toggle switch with clear red OFF / green ON states */
.nzb-toggle-switch,
.nzb-toggle-slider {
    position: relative !important;
    width: 64px !important;
    height: 32px !important;
    background: #ef4444 !important;
    border-radius: 16px !important;
    transition: background 0.3s ease, box-shadow 0.3s ease !important;
    flex-shrink: 0 !important;
    display: inline-block !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.6), 0 0 16px rgba(239, 68, 68, 0.3) !important;
    cursor: pointer !important;
    vertical-align: middle !important;
}

/* The sliding circle/thumb */
.nzb-toggle-switch::after,
.nzb-toggle-slider::after {
    content: '' !important;
    position: absolute !important;
    top: 4px !important;
    left: 4px !important;
    width: 24px !important;
    height: 24px !important;
    background: #fff !important;
    border-radius: 50% !important;
    transition: transform 0.3s ease !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3) !important;
    z-index: 2 !important;
}

/* ON text (shown when checked) */
.nzb-toggle-switch::before,
.nzb-toggle-slider::before {
    content: 'OFF' !important;
    position: absolute !important;
    top: 50% !important;
    right: 8px !important;
    transform: translateY(-50%) !important;
    font-size: 10px !important;
    font-weight: 700 !important;
    letter-spacing: 0.5px !important;
    color: rgba(255, 255, 255, 0.85) !important;
    z-index: 1 !important;
    pointer-events: none !important;
}

/* Checked (ON) state */
.nzb-toggle-row input:checked + .nzb-toggle-switch,
.nzb-toggle-row input:checked + .nzb-toggle-slider {
    background: #22c55e !important;
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.6), 0 0 16px rgba(34, 197, 94, 0.4) !important;
}

.nzb-toggle-row input:checked + .nzb-toggle-switch::after,
.nzb-toggle-row input:checked + .nzb-toggle-slider::after {
    transform: translateX(32px) !important;
}

.nzb-toggle-row input:checked + .nzb-toggle-switch::before,
.nzb-toggle-row input:checked + .nzb-toggle-slider::before {
    content: 'ON' !important;
    left: 10px !important;
    right: auto !important;
}

/* ── Connection Test Status (modal) ──────────────── */
.nzb-server-test-status {
    margin-top: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    background: rgba(30, 41, 59, 0.7);
    border: 1px solid rgba(148, 163, 184, 0.15);
    transition: border-color 0.3s, background 0.3s;
}

.nzb-server-test-status.test-testing {
    border-color: rgba(99, 102, 241, 0.4);
    background: rgba(99, 102, 241, 0.08);
}

.nzb-server-test-status.test-success {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.08);
}

.nzb-server-test-status.test-fail {
    border-color: rgba(239, 68, 68, 0.5);
    background: rgba(239, 68, 68, 0.08);
}

.nzb-server-test-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: #94a3b8;
}

.nzb-server-test-status.test-testing .nzb-server-test-inner {
    color: #a5b4fc;
}

.nzb-server-test-status.test-success .nzb-server-test-inner {
    color: #4ade80;
}

.nzb-server-test-status.test-fail .nzb-server-test-inner {
    color: #f87171;
}

.nzb-server-test-inner i {
    font-size: 16px;
}

/* ── Server card status indicator ──────────────── */
.nzb-server-status-dot {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #475569;
    margin-right: 6px;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}

.nzb-server-status-dot.status-checking {
    background: #6366f1;
}

.nzb-server-status-dot.status-online {
    background: #22c55e;
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.nzb-server-status-dot.status-offline {
    background: #ef4444;
    box-shadow: 0 0 6px rgba(239, 68, 68, 0.4);
}

/* ── Test Connection button style (subtle/ghost) ────────────── */
.nzb-btn-test-subtle {
    background: transparent !important;
    color: #64748b !important;
    border: 1px solid rgba(148, 163, 184, 0.15) !important;
    font-size: 0.85rem !important;
}
.nzb-btn-test-subtle:hover {
    background: rgba(99, 102, 241, 0.1) !important;
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.3) !important;
}

.nzb-server-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* ═══════ File Browser Modal (NZB Hunt) ═══════ */
.nzb-browse-modal {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: none;
    align-items: center;
    justify-content: center;
}

.nzb-browse-modal[style*="display: flex"] {
    display: flex !important;
}

.nzb-browse-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1100;
}

.nzb-browse-content {
    position: relative;
    z-index: 1101;
    background: rgba(15, 23, 42, 0.98);
    border: 2px solid rgba(148, 163, 184, 0.3);
    border-radius: 12px;
    min-width: 400px;
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nzb-browse-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.nzb-browse-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #f8fafc;
}

.nzb-browse-close {
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    font-size: 1rem;
}

.nzb-browse-close:hover {
    color: #f8fafc;
}

.nzb-browse-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}

.nzb-browse-body label {
    display: block;
    margin-bottom: 8px;
    color: #94a3b8;
    font-size: 0.9rem;
}

#nzb-browse-path-input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 8px;
    color: #f8fafc;
    font-family: monospace;
    box-sizing: border-box;
}

#nzb-browse-path-input:focus {
    border-color: #6366f1;
    outline: none;
}

.nzb-browse-up-row {
    margin-bottom: 12px;
}

.nzb-browse-up-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    color: #0f172a;
    border: 1px solid rgba(245, 158, 11, 0.5);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

.nzb-browse-up-btn:hover {
    background: linear-gradient(135deg, #fbbf24 0%, #fcd34d 100%);
}

.nzb-browse-up-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nzb-browse-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 8px;
    background: rgba(15, 23, 42, 0.5);
}

.nzb-browse-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    border-bottom: 1px solid rgba(148, 163, 184, 0.1);
    color: #e2e8f0;
}

.nzb-browse-item:hover {
    background: rgba(148, 163, 184, 0.15);
}

.nzb-browse-item:last-child {
    border-bottom: none;
}

.nzb-browse-item i {
    color: #94a3b8;
}

.nzb-browse-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nzb-browse-new-folder-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 0.85rem;
    background: rgba(99, 102, 241, 0.2);
    border: 1px solid rgba(99, 102, 241, 0.4);
    color: #a5b4fc;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
}

.nzb-browse-new-folder-btn:hover {
    background: rgba(99, 102, 241, 0.3);
    border-color: rgba(99, 102, 241, 0.5);
}

/* Inline create/delete rows */
.nzb-browse-inline-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 8px;
}

.nzb-browse-inline-row i {
    color: #818cf8;
    font-size: 1rem;
    flex-shrink: 0;
}

.nzb-browse-delete-row {
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.3);
}

.nzb-browse-delete-row i {
    color: #f87171 !important;
}

.nzb-browse-delete-row span {
    color: #f1f5f9;
    font-size: 0.9rem;
    font-weight: 500;
}

.nzb-browse-delete-hint {
    color: #94a3b8 !important;
    font-weight: 400 !important;
    font-size: 0.8rem !important;
    flex: 1;
}

.nzb-browse-inline-input {
    flex: 1;
    padding: 7px 10px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: #f8fafc;
    font-family: monospace;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.nzb-browse-inline-input:focus {
    outline: none;
    border-color: #6366f1;
}

.nzb-browse-inline-ok {
    padding: 6px 12px;
    background: rgba(16, 185, 129, 0.2);
    border: 1px solid rgba(16, 185, 129, 0.4);
    border-radius: 6px;
    color: #6ee7b7;
    cursor: pointer;
    font-size: 0.85rem;
}

.nzb-browse-inline-ok:hover {
    background: rgba(16, 185, 129, 0.3);
}

.nzb-browse-inline-cancel {
    padding: 6px 12px;
    background: rgba(148, 163, 184, 0.15);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 6px;
    color: #94a3b8;
    cursor: pointer;
    font-size: 0.85rem;
}

.nzb-browse-inline-cancel:hover {
    background: rgba(148, 163, 184, 0.25);
}

.nzb-browse-inline-danger {
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 6px;
    color: #f87171;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.nzb-browse-inline-danger:hover {
    background: rgba(239, 68, 68, 0.3);
}

/* Browse item with actions (rename/delete) */
.nzb-browse-item {
    justify-content: space-between;
}

.nzb-browse-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.nzb-browse-item-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
    opacity: 0.7;
}

.nzb-browse-item:hover .nzb-browse-item-actions {
    opacity: 1;
}

.nzb-browse-item-btn {
    padding: 4px 8px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    border-radius: 4px;
    font-size: 0.8rem;
}

.nzb-browse-item-btn:hover {
    background: rgba(148, 163, 184, 0.2);
    color: #e2e8f0;
}

.nzb-browse-item-btn[data-action="delete"]:hover {
    color: #f87171;
}

/* Inline rename input */
.nzb-browse-item-rename-input {
    flex: 1;
    padding: 5px 8px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 5px;
    color: #f8fafc;
    font-family: monospace;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.nzb-browse-item-rename-input:focus {
    outline: none;
    border-color: #6366f1;
}

.nzb-browse-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid rgba(148, 163, 184, 0.2);
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
    #nzb-hunt-settings-advanced .nzb-adv-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .nzb-hunt-container {
        padding: 16px 0;
    }
    .nzb-servers-guidance {
        flex-direction: column;
    }
    .nzb-server-grid-wrapper {
        grid-template-columns: 1fr;
    }
    .nzb-status-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
    .nzb-status-divider {
        display: none;
    }
    .nzb-tab,
    .nzb-settings-tab {
        padding: 10px 16px;
        font-size: 0.85rem;
    }
    .nzb-queue-item {
        flex-wrap: wrap;
        gap: 8px;
    }
    .nzb-queue-item-progress {
        width: 100%;
        order: 10;
    }
    .nzb-folder-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    .nzb-folder-label {
        flex: none;
    }
    .nzb-folder-input-group {
        flex-direction: column;
    }
    .nzb-form-row {
        flex-direction: column;
        gap: 0;
    }
    #nzb-server-grid,
    .nzb-cat-grid {
        grid-template-columns: 1fr;
    }
    .nzb-browse-content {
        min-width: 0;
        width: 95%;
    }
    .nzb-cat-base-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
    .nzb-cat-card-body {
        flex-direction: column;
    }
    .nzb-cat-card-meta {
        flex-wrap: wrap;
    }
}

/* ── Mobile: Queue as compact cards (≤768px) ───────────────────── */
@media (max-width: 768px) {
    .nzb-queue-table { display: block; }
    .nzb-queue-table thead { display: none; }
    .nzb-queue-table tbody { display: block; }
    .nzb-queue-table tbody tr {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0 10px;
        position: relative;
        background: rgba(15, 23, 42, 0.5);
        border: 1px solid rgba(255, 255, 255, 0.06);
        border-radius: 10px;
        margin-bottom: 8px;
        padding: 10px 12px;
    }
    .nzb-queue-table tbody tr.nzb-row-selected {
        border-color: rgba(99, 102, 241, 0.35);
        background: rgba(99, 102, 241, 0.06);
    }
    .nzb-queue-table tbody tr:last-child { margin-bottom: 0; }

    .nzb-queue-table td {
        display: flex;
        align-items: center;
        gap: 4px;
        border: none;
        padding: 3px 0;
        font-size: 0.78rem;
        min-width: 0;
        overflow: hidden;
    }
    /* Hide all ::before by default; we add them selectively */
    .nzb-queue-table td::before { display: none; }
    .nzb-queue-table td[data-label]::before {
        display: inline;
        content: attr(data-label) ":";
        font-size: 0.62rem;
        font-weight: 700;
        color: #475569;
        text-transform: uppercase;
        letter-spacing: 0.02em;
        flex-shrink: 0;
        white-space: nowrap;
    }
    .nzb-queue-table td[data-label=""]::before { display: none; }

    /* ── Checkbox: top-right corner ── */
    .nzb-queue-table .nzb-col-check {
        position: absolute;
        top: 10px;
        right: 10px;
        width: auto !important;
        min-width: auto !important;
        max-width: none !important;
        padding: 0 !important;
    }
    .nzb-queue-table .nzb-col-check::before { display: none !important; }
    .nzb-queue-table .nzb-col-check input[type="checkbox"] {
        width: 16px;
        height: 16px;
    }

    /* ── Name: full-width top row ── */
    .nzb-queue-table .nzb-col-name {
        grid-column: 1 / -1;
        padding-right: 28px;
        padding-bottom: 5px;
        margin-bottom: 2px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    }
    .nzb-queue-table .nzb-col-name::before { display: none !important; }
    .nzb-queue-table .nzb-cell-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0.8rem;
    }

    /* ── 2-col grid rows: cat+progress, size+priority, eta+status ── */
    .nzb-queue-table .nzb-col-cat    { grid-column: 1; }
    .nzb-queue-table .nzb-col-pct    { grid-column: 2; }
    .nzb-queue-table .nzb-col-size   { grid-column: 1; white-space: nowrap; }
    .nzb-queue-table .nzb-col-priority { grid-column: 2; }
    .nzb-queue-table .nzb-col-eta    { grid-column: 1; }
    .nzb-queue-table .nzb-col-status { grid-column: 2; }

    /* Priority dropdown compact */
    .nzb-queue-table .nzb-col-priority::before { display: none !important; }
    .nzb-queue-table .nzb-col-priority .nzb-priority-select {
        font-size: 0.74rem;
        padding: 2px 4px;
        max-width: none;
        width: 100%;
    }

    /* ── Actions: full-width bottom ── */
    .nzb-queue-table .nzb-col-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        padding-top: 5px;
        margin-top: 2px;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        gap: 6px;
    }
    .nzb-queue-table .nzb-col-actions::before { display: none !important; }
    .nzb-queue-table .nzb-col-actions .nzb-item-btn {
        width: 32px;
        height: 32px;
        font-size: 0.7rem;
    }

    /* ── Mass action bar ── */
    .nzb-mass-action-bar {
        flex-wrap: nowrap;
        padding: 6px 10px;
        gap: 8px;
    }
    .nzb-mass-priority-select { flex: 1; min-width: 0; }
}

/* ── Mobile: Status bar improvements (≤768px) ──────────────────── */
@media (max-width: 768px) {
    .nzb-status-bar {
        padding: 12px 14px;
        gap: 12px;
    }
    .nzb-status-metrics {
        flex-wrap: wrap;
        gap: 12px 20px;
    }
    .nzb-status-item {
        font-size: 0.8rem;
    }
    .nzb-status-value {
        font-size: 0.9rem;
    }
    .nzb-status-actions {
        width: 100%;
        justify-content: flex-end;
        margin-top: 4px;
        padding-top: 8px;
        border-top: 1px solid rgba(71, 85, 105, 0.3);
    }
}

/* ═════════════════════════════════════════════════════════════════
   CATEGORIES
   ═════════════════════════════════════════════════════════════════ */

/* ── Base folder row ─────────────────────────────────────────── */
.nzb-cat-base-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 10px;
    margin-bottom: 16px;
}

.nzb-cat-base-label {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 260px;
}

.nzb-cat-base-label i {
    font-size: 1.1rem;
}

/* ── Default category info ───────────────────────────────────── */
.nzb-cat-default-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(99, 102, 241, 0.06);
    border: 1px dashed rgba(99, 102, 241, 0.2);
    border-radius: 10px;
    margin-bottom: 20px;
}

.nzb-cat-default-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nzb-badge-default {
    background: rgba(99, 102, 241, 0.2);
    color: #a5b4fc;
}

.nzb-cat-default-text {
    color: #94a3b8;
    font-size: 0.85rem;
}

.nzb-cat-default-details {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nzb-cat-default-path {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #a5b4fc;
    padding: 4px 10px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: 6px;
}

/* ── Category card grid ──────────────────────────────────────── */
.nzb-cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 14px;
}

/* ── Category card ───────────────────────────────────────────── */
.nzb-cat-card {
    padding: 0;
    border-radius: 10px;
    background: linear-gradient(145deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(148, 163, 184, 0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.nzb-cat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
    border-color: rgba(167, 139, 250, 0.3);
}

.nzb-cat-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px 10px;
    border-bottom: 1px solid rgba(148, 163, 184, 0.06);
}

.nzb-cat-card-name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 600;
    color: #f8fafc;
    min-width: 0;
}

.nzb-cat-card-name i {
    color: #a78bfa;
    flex-shrink: 0;
}

.nzb-cat-card-name span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nzb-cat-card-badges {
    display: flex;
    gap: 5px;
    flex-shrink: 0;
}

.nzb-badge-processing {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

.nzb-badge-priority-cat {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

.nzb-cat-card-body {
    padding: 12px 16px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nzb-cat-card-path {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.85rem;
}

.nzb-cat-card-path i {
    width: 16px;
    text-align: center;
    color: #475569;
}

.nzb-cat-card-path span {
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #cbd5e1;
    word-break: break-all;
}

.nzb-cat-card-meta {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.nzb-cat-card-meta-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    color: #64748b;
}

.nzb-cat-card-meta-item i {
    font-size: 0.7rem;
}

.nzb-cat-card-meta-item span {
    color: #94a3b8;
}

.nzb-cat-card-indexer {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    color: #94a3b8;
    font-size: 0.8rem;
    margin-top: 2px;
}

.nzb-cat-card-indexer i {
    width: 16px;
    text-align: center;
    color: #475569;
    margin-top: 2px;
}

.nzb-cat-card-indexer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.nzb-cat-indexer-tag {
    padding: 2px 8px;
    background: rgba(148, 163, 184, 0.08);
    border: 1px solid rgba(148, 163, 184, 0.12);
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #94a3b8;
}

.nzb-cat-card-footer {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    border-top: 1px solid rgba(148, 163, 184, 0.06);
}

.nzb-cat-card-footer .nzb-btn {
    flex: 1;
    justify-content: center;
    font-size: 0.8rem;
    padding: 7px 10px;
}

/* Read-only category cards (auto-generated, no Edit/Delete) */
.nzb-cat-card-readonly {
    cursor: default;
}
.nzb-cat-card-readonly:hover {
    transform: none;
    box-shadow: none;
    border-color: rgba(148, 163, 184, 0.1);
}
.nzb-cat-path-readonly span {
    color: #64748b;
    opacity: 0.9;
}
.nzb-cat-status {
    display: inline-flex;
    align-items: center;
}
.nzb-cat-status-ok {
    color: #22c55e;
    font-size: 1rem;
}
.nzb-cat-status-error {
    color: #ef4444;
    font-size: 1rem;
}
.nzb-cat-error-msg {
    font-size: 0.8rem;
    color: #f87171;
    margin-top: 4px;
}

/* ── Add category card ───────────────────────────────────────── */
.nzb-cat-add-card {
    min-height: 160px;
    border: 2px dashed rgba(167, 139, 250, 0.2);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.nzb-cat-add-card:hover {
    border-color: rgba(167, 139, 250, 0.4);
    background: rgba(167, 139, 250, 0.04);
}

.nzb-cat-add-card .add-icon {
    font-size: 2rem;
    color: #a78bfa;
}

.nzb-cat-add-card .add-text {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}

/* ── Category form select ────────────────────────────────────── */
.nzb-form-select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid #475569;
    border-radius: 8px;
    color: #e2e8f0;
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    box-sizing: border-box;
}

.nzb-form-select:focus {
    border-color: #a78bfa;
    outline: none;
    box-shadow: 0 0 0 2px rgba(167, 139, 250, 0.15);
}

/* ═══════════════════════════════════════════════════
   Queue Table (one-liner columns)
═══════════════════════════════════════════════════ */
/* overflow handled by #nzb-hunt-section rule above */

.nzb-queue-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    table-layout: fixed;
}

.nzb-queue-table thead {
    background: rgba(15, 23, 42, 0.8);
    border-bottom: 1px solid rgba(71, 85, 105, 0.5);
}

.nzb-queue-table th {
    padding: 8px 10px;
    text-align: left;
    font-weight: 600;
    color: #94a3b8;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nzb-queue-table td {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(71, 85, 105, 0.25);
    color: #cbd5e1;
    vertical-align: middle;
}

.nzb-queue-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}

/* Column widths */
.nzb-queue-table .nzb-col-check { width: 36px; min-width: 36px; max-width: 36px; text-align: center; padding: 0 4px !important; }
.nzb-queue-table .nzb-col-name { width: 28%; min-width: 120px; }
.nzb-queue-table .nzb-col-cat   { width: 8%;  min-width: 60px; }
.nzb-queue-table .nzb-col-pct  { width: 7%;  min-width: 52px; }
.nzb-queue-table .nzb-col-size { width: 13%; min-width: 100px; }
.nzb-queue-table .nzb-col-priority { width: 11%; min-width: 95px; }
.nzb-queue-table .nzb-col-eta  { width: 8%;  min-width: 60px; }
.nzb-queue-table .nzb-col-status { width: 11%; min-width: 85px; }
.nzb-queue-table .nzb-col-actions { width: 8%; min-width: 72px; text-align: right; }

/* Checkbox styling */
.nzb-queue-table .nzb-col-check input[type="checkbox"] {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: #6366f1;
    vertical-align: middle;
}

/* Selected row highlight */
.nzb-queue-row.nzb-row-selected {
    background: rgba(99, 102, 241, 0.08) !important;
}

.nzb-cell-name {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nzb-cell-cat {
    text-transform: uppercase;
    font-size: 0.72rem;
    color: #818cf8;
    font-weight: 600;
}

/* Priority dropdown in-row */
.nzb-priority-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 4px;
    color: #e2e8f0;
    padding: 3px 6px;
    font-size: 0.74rem;
    cursor: pointer;
    outline: none;
    width: 100%;
}
.nzb-priority-select:focus { border-color: #6366f1; }

/* Priority color classes */
.nzb-priority-force .nzb-priority-select { color: #f87171; border-color: rgba(248, 113, 113, 0.4); }
.nzb-priority-high .nzb-priority-select { color: #fbbf24; border-color: rgba(251, 191, 36, 0.4); }
.nzb-priority-normal .nzb-priority-select { color: #e2e8f0; }
.nzb-priority-low .nzb-priority-select { color: #94a3b8; }
.nzb-priority-stop .nzb-priority-select { color: #64748b; border-color: rgba(100, 116, 139, 0.4); }

/* Mass action bar */
.nzb-mass-action-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: rgba(99, 102, 241, 0.08);
    border-top: 1px solid rgba(99, 102, 241, 0.2);
    border-bottom: 1px solid rgba(99, 102, 241, 0.2);
}
.nzb-mass-count {
    font-size: 0.78rem;
    color: #a5b4fc;
    font-weight: 600;
    white-space: nowrap;
}
.nzb-mass-priority-select {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 4px;
    color: #e2e8f0;
    padding: 4px 8px;
    font-size: 0.76rem;
    cursor: pointer;
    outline: none;
}
.nzb-mass-priority-select:focus { border-color: #6366f1; }
.nzb-mass-delete-btn {
    margin-left: auto;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 4px;
    color: #f87171;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 0.82rem;
    transition: background 0.15s, color 0.15s;
}
.nzb-mass-delete-btn:hover {
    background: rgba(239, 68, 68, 0.25);
    color: #fca5a5;
}

.nzb-col-eta  { color: #a78bfa; }

/* Status column state colors */
.nzb-queue-row.nzb-item-downloading .nzb-col-status { color: #4ade80; }
.nzb-queue-row.nzb-item-assembling .nzb-col-status { color: #818cf8; }
.nzb-queue-row.nzb-item-queued .nzb-col-status     { color: #94a3b8; }
.nzb-queue-row.nzb-item-paused .nzb-col-status     { color: #fbbf24; }
.nzb-queue-row.nzb-item-failed .nzb-col-status     { color: #f87171; }
.nzb-queue-row.nzb-item-extracting .nzb-col-status { color: #818cf8; }
.nzb-queue-row.nzb-item-completed .nzb-col-status  { color: #22c55e; }

.nzb-queue-table .nzb-col-status {
    min-width: 110px;
}
.nzb-queue-table .nzb-col-status i {
    margin-right: 4px;
    font-size: 0.7rem;
}
.nzb-status-label {
    display: block;
    font-weight: 600;
    font-size: 0.78rem;
    line-height: 1.3;
    white-space: nowrap;
}
.nzb-status-sub {
    display: block;
    font-size: 0.65rem;
    font-weight: 400;
    color: #94a3b8;
    margin-top: 1px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}
.nzb-status-msg-warn { color: #f59e0b !important; }

.nzb-progress-pct { font-variant-numeric: tabular-nums; }
.nzb-missing-icon {
    color: #f59e0b;
    font-size: 0.7rem;
    margin-left: 2px;
    cursor: help;
}

/* State icons */
.nzb-icon-downloading { color: #4ade80; }
.nzb-icon-assembling { color: #818cf8; }
.nzb-icon-queued { color: #94a3b8; }
.nzb-icon-paused { color: #fbbf24; }
.nzb-icon-extracting { color: #818cf8; }
.nzb-icon-completed { color: #22c55e; }
.nzb-icon-failed { color: #ef4444; }

/* Action buttons in table */
.nzb-queue-table .nzb-col-actions {
    white-space: nowrap;
}

.nzb-item-btn {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #64748b;
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.65rem;
    transition: all 0.15s;
    padding: 0;
    margin-left: 2px;
}

.nzb-item-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
    border-color: rgba(255, 255, 255, 0.2);
}

.nzb-item-btn-danger:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.35);
    color: #ef4444;
}

/* ═══ History table – same layout as Queue (NAME | CATEGORY | SIZE | RESULT | AGE | actions) ═══ */
.nzb-history-table {
    /* Inherits nzb-queue-table styles; RESULT/AGE columns use status/eta slots */
}
.nzb-history-table .nzb-col-status { width: 14%; min-width: 100px; }  /* RESULT: wider for error text */
.nzb-history-table .nzb-col-eta { width: 10%; min-width: 80px; text-align: right; color: #64748b; font-size: 0.78rem; }  /* AGE */

/* Result column styling */
.nzb-hist-result-ok   { color: #22c55e; font-weight: 500; }
.nzb-hist-result-fail  { color: #ef4444; font-weight: 500; }

/* Per-row delete button */
.nzb-hist-delete-btn {
    background: none;
    border: none;
    color: #475569;
    cursor: pointer;
    font-size: 0.82rem;
    padding: 4px 6px;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.nzb-hist-delete-btn:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ─── Queue/History footer (search, pagination, stats) ───
   Fixed at bottom of body; only table scrolls above */
.nzb-queue-footer,
.nzb-history-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-top: 1px solid rgba(71, 85, 105, 0.3);
    font-size: 0.76rem;
    color: #64748b;
    flex-wrap: wrap;
    gap: 10px;
    box-sizing: border-box;
}
.nzb-hist-search {
    display: flex;
    align-items: center;
    gap: 6px;
}
.nzb-hist-search input {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(71, 85, 105, 0.4);
    border-radius: 4px;
    color: #e2e8f0;
    padding: 4px 8px;
    font-size: 0.76rem;
    width: 140px;
    outline: none;
}
.nzb-hist-search input:focus { border-color: #6366f1; }
.nzb-hist-search input::placeholder { color: #475569; }

.nzb-hist-pagination {
    display: flex;
    align-items: center;
    gap: 2px;
}
.nzb-hist-pagination button {
    background: none;
    border: 1px solid rgba(71, 85, 105, 0.3);
    color: #94a3b8;
    padding: 3px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.74rem;
    min-width: 28px;
    transition: background 0.15s, color 0.15s;
}
.nzb-hist-pagination button:hover { background: rgba(99, 102, 241, 0.1); color: #e2e8f0; }
.nzb-hist-pagination button.active { background: #6366f1; color: #fff; border-color: #6366f1; }
.nzb-hist-pagination button:disabled { opacity: 0.4; cursor: default; }
.nzb-hist-pagination span { color: #475569; padding: 0 4px; }

.nzb-hist-stats {
    display: flex;
    gap: 16px;
    color: #64748b;
    font-size: 0.76rem;
}
.nzb-hist-stats span { white-space: nowrap; }
.nzb-hist-stats i { margin-right: 4px; color: #475569; }

/* ═══ Gear / Display-prefs button in status bar ═══ */
.nzb-display-prefs-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(71, 85, 105, 0.35);
    color: #94a3b8;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s, background 0.2s, border-color 0.2s, transform 0.3s;
}
.nzb-display-prefs-btn:hover {
    color: #e2e8f0;
    background: rgba(99, 102, 241, 0.12);
    border-color: rgba(99, 102, 241, 0.4);
    transform: rotate(45deg);
}

/* ═══ Display Preferences Modal ═══ */
.nzb-prefs-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: nzbFadeIn 0.2s ease;
}
@keyframes nzbFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.nzb-prefs-modal {
    background: linear-gradient(160deg, #1e293b 0%, #0f172a 100%);
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 14px;
    width: 380px;
    max-width: 92vw;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,255,255,0.04);
    animation: nzbSlideUp 0.25s ease;
}
@keyframes nzbSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.nzb-prefs-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid rgba(71, 85, 105, 0.3);
}
.nzb-prefs-header h3 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #f1f5f9;
}
.nzb-prefs-close {
    background: none;
    border: none;
    color: #64748b;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 0 4px;
    line-height: 1;
    transition: color 0.15s;
}
.nzb-prefs-close:hover { color: #ef4444; }

.nzb-prefs-body {
    padding: 18px 24px;
}

.nzb-prefs-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 0;
    gap: 16px;
}
.nzb-prefs-label {
    color: #cbd5e1;
    font-size: 0.85rem;
    font-weight: 500;
}

.nzb-prefs-select {
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(71, 85, 105, 0.45);
    border-radius: 6px;
    color: #e2e8f0;
    padding: 6px 12px;
    font-size: 0.82rem;
    cursor: pointer;
    outline: none;
    min-width: 160px;
    transition: border-color 0.15s;
}
.nzb-prefs-select:focus { border-color: #6366f1; }

.nzb-prefs-divider {
    border-top: 1px solid rgba(71, 85, 105, 0.25);
    margin: 12px 0 8px;
}
.nzb-prefs-section-title {
    color: #64748b;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    margin-bottom: 4px;
}

/* Prefs-modal toggle – unique class (avoids nzb-toggle-slider conflict) */
.nzb-pref-toggle {
    position: relative;
    display: inline-block;
    width: 34px;
    height: 18px;
    cursor: pointer;
    flex-shrink: 0;
    vertical-align: middle;
}
.nzb-pref-toggle input[type="checkbox"] {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
    margin: 0;
    padding: 0;
}
.nzb-pref-slider {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #334155;
    border: 1px solid rgba(71, 85, 105, 0.5);
    border-radius: 18px;
    transition: background 0.25s, border-color 0.25s;
}
.nzb-pref-slider::before {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    left: 2px;
    bottom: 2px;
    background: #64748b;
    border-radius: 50%;
    transition: transform 0.25s, background 0.25s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.nzb-pref-toggle input[type="checkbox"]:checked + .nzb-pref-slider {
    background: #22c55e;
    border-color: #16a34a;
}
.nzb-pref-toggle input[type="checkbox"]:checked + .nzb-pref-slider::before {
    transform: translateX(16px);
    background: #fff;
}

.nzb-prefs-footer {
    padding: 14px 22px 18px;
    display: flex;
    justify-content: flex-end;
    border-top: 1px solid rgba(71, 85, 105, 0.2);
}
