/* ══════════════════════════════════════════════════════════════
   Unraid Multi-Stream Server Dashboard Styles
   ══════════════════════════════════════════════════════════════ */

:root {
    --bg-dark: #111420;
    --card-bg: #1a1e30;
    --card-border: rgba(255, 255, 255, 0.08);
    --input-bg: #111322;
    --input-border: #2c324b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #4ade80;
    --accent-hover: #22c55e;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --warning: #fbbf24;
    --info: #38bdf8;
    --font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --mono-family: 'JetBrains Mono', monospace;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    padding: 24px;
}

.dashboard-layout {
    max-width: 1280px;
    margin: 0 auto;
}

/* ── Header ─────────────────────────────────────────────────── */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 18px 26px;
    border-radius: 16px;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    font-size: 36px;
}

.logo-area h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sub-title {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 500;
}

.header-badges {
    display: flex;
    gap: 12px;
}

.badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.badge-hw {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

.badge-offline {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.badge-live {
    background: rgba(74, 222, 128, 0.2);
    color: var(--accent);
    border: 1px solid rgba(74, 222, 128, 0.4);
    animation: pulse 2s infinite;
}

.badge-standby {
    background: rgba(251, 191, 36, 0.2);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.4);
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ── Channel Tabs Bar ───────────────────────────────────────── */
.channel-bar-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    gap: 12px;
}

.channel-tabs {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.channel-tab {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 10px 20px;
    border-radius: 12px;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: all 0.2s;
}

.channel-tab:hover {
    color: var(--text-main);
    border-color: rgba(255, 255, 255, 0.2);
}

.channel-tab.active {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent);
    border-color: rgba(74, 222, 128, 0.4);
}

.tab-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #64748b;
}

.tab-indicator.live {
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
}

.tab-indicator.standby {
    background: var(--warning);
}

.btn-add-channel {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
    border: 1px dashed rgba(56, 189, 248, 0.4);
    padding: 10px 18px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-add-channel:hover {
    background: rgba(56, 189, 248, 0.3);
}

/* ── Grid Layout ────────────────────────────────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

@media (max-width: 960px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 24px;
}

.card h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
    color: #e2e8f0;
}

.card-header-flex {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-header-flex h2 {
    margin-bottom: 0;
}

.text-accent {
    color: var(--accent);
}

.text-danger {
    color: #fca5a5;
}

/* ── Status Rows ────────────────────────────────────────────── */
.status-rows {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-bottom: 20px;
}

.status-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    padding: 14px 18px;
    border-radius: 12px;
}

.status-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.status-icon {
    font-size: 22px;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

.status-title {
    font-weight: 700;
    font-size: 15px;
}

.status-sub {
    font-size: 12px;
    color: var(--text-muted);
}

.overlay-actions {
    display: flex;
    gap: 8px;
}

.pill {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 12px;
    border-radius: 8px;
    text-decoration: none;
    display: inline-block;
}

.pill-offline {
    background: rgba(239, 68, 68, 0.15);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.pill-online {
    background: rgba(74, 222, 128, 0.15);
    color: var(--accent);
    border: 1px solid rgba(74, 222, 128, 0.3);
}

.pill-warning {
    background: rgba(251, 191, 36, 0.15);
    color: var(--warning);
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.pill-link {
    background: rgba(56, 189, 248, 0.15);
    color: var(--info);
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ── Stream Actions ─────────────────────────────────────────── */
.stream-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.btn {
    width: 100%;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--accent);
    color: #0f172a;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: var(--danger-hover);
}

.btn-save {
    background: #38bdf8;
    color: #0f172a;
    margin-top: 14px;
}

.btn-save:hover {
    background: #0284c7;
    color: white;
}

.btn-text {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.8;
}

.btn-text:hover {
    opacity: 1;
}

/* ── RTMP Box ───────────────────────────────────────────────── */
.rtmp-instructions {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.05);
    padding: 14px;
    border-radius: 10px;
    font-size: 13px;
}

.code-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #0b0f19;
    padding: 10px 14px;
    border-radius: 8px;
    margin-top: 8px;
    font-family: var(--mono-family);
    color: #38bdf8;
}

.btn-copy {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.8;
}

/* ── Log Console ────────────────────────────────────────────── */
.log-console {
    background: #0b0f19;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 14px;
    height: 250px;
    overflow-y: auto;
    font-family: var(--mono-family);
    font-size: 11.5px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.log-line {
    color: #cbd5e1;
    word-break: break-all;
    line-height: 1.4;
}

.text-muted {
    color: #64748b;
}

/* ── Multi-Stream Cards & Sections ──────────────────────────── */
.section-divider {
    display: flex;
    align-items: center;
    margin: 22px 0 14px;
    font-size: 13px;
    font-weight: 700;
    color: #cbd5e1;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 8px;
}

.dest-card {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    padding: 12px 16px;
    margin-bottom: 10px;
}

.dest-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dest-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
}

.dest-body {
    margin-top: 10px;
}

/* ── Form Controls ──────────────────────────────────────────── */
.form-group {
    margin-bottom: 14px;
    text-align: left;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 12.5px;
    color: var(--text-muted);
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="number"],
select {
    width: 100%;
    padding: 11px 13px;
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 10px;
    color: white;
    font-family: var(--font-family);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

input:focus, select:focus {
    border-color: var(--accent);
}

.switch-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    font-size: 13px;
    color: #e2e8f0;
}

.switch-label input {
    display: none;
}

.slider {
    position: relative;
    width: 44px;
    height: 24px;
    background-color: var(--input-border);
    border-radius: 24px;
    transition: 0.3s;
    flex-shrink: 0;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: 0.3s;
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider:before {
    transform: translateX(20px);
    background-color: #0f172a;
}
