/* =========================================================================
   Saral Streaming - theme variables
   Flat, solid colors only (no gradients) - brand blue is #007bff exactly,
   as requested. Edit here to re-theme the whole app in one place.
   ========================================================================= */
:root {
    --brand-primary: #007bff;
    --brand-primary-dark: #0062cc;
    --brand-primary-light: #e8f2ff;

    --fb-color: #1877F2;
    --yt-color: #FF0000;
    --own-color: #6b7280;

    --success: #16A34A;
    --success-bg: #F0FDF4;
    --warning: #D97706;
    --warning-bg: #FFFBEB;
    --danger: #DC2626;
    --danger-bg: #FEF2F2;

    --bg-app: #F5F7FA;
    --bg-panel: #FFFFFF;
    --bg-sidebar: #0F172A;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-inverse: #F9FAFB;
    --border-color: #E5E7EB;

    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --shadow-card: 0 1px 2px rgba(16,24,40,0.05), 0 1px 3px rgba(16,24,40,0.06);
    --shadow-card-hover: 0 4px 10px rgba(16,24,40,0.08), 0 2px 4px rgba(16,24,40,0.06);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--bg-app);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-primary); text-decoration: none; }
h1 { font-size: 1.6rem; font-weight: 700; margin: 0; letter-spacing: -0.01em; }
h3 { font-size: 1rem; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--text-secondary); font-size: 0.875rem; }
.mt { margin-top: 24px; }

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 236px;
    background: var(--bg-sidebar);
    color: var(--text-inverse);
    padding: 22px 14px;
    flex-shrink: 0;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand-mark {
    width: 30px; height: 30px; border-radius: 8px;
    background: var(--brand-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; color: white; font-size: 0.9rem;
}
.brand-mark.large { width: 52px; height: 52px; font-size: 1.4rem; border-radius: 13px; }
.brand-name { font-weight: 700; font-size: 0.95rem; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-section-label {
    font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
    color: #6B7280; padding: 16px 12px 6px;
}
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 12px; border-radius: var(--radius-sm);
    color: #CBD5E1; font-size: 0.875rem; font-weight: 500;
    transition: background 0.12s;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: white; }
.nav-link.active { background: var(--brand-primary); color: white; }
.nav-icon { opacity: 0.85; width: 18px; text-align: center; font-size: 0.8rem; font-weight: 700; }

.app-main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
    display: flex; justify-content: flex-end; align-items: center; gap: 16px;
    padding: 14px 32px; border-bottom: 1px solid var(--border-color);
    background: var(--bg-panel);
}
.topbar-user { font-size: 0.85rem; color: var(--text-secondary); }
.app-content { padding: 28px 32px; max-width: 1120px; width: 100%; margin: 0 auto; overflow-x: hidden; }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--brand-primary); }

/* ---------- Header ---------- */
.page-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 22px; flex-wrap: wrap; gap: 12px; }
.page-subtitle { color: var(--text-secondary); margin: 4px 0 0; font-size: 0.9rem; }

/* ---------- Buttons ---------- */
.btn-primary, .btn-ghost, .btn-danger {
    display: inline-flex; align-items: center; justify-content: center;
    padding: 9px 16px; border-radius: var(--radius-sm);
    font-weight: 600; font-size: 0.875rem; border: none; cursor: pointer;
    transition: opacity 0.15s ease, background 0.15s ease;
}
.btn-primary { background: var(--brand-primary); color: white; }
.btn-primary:hover { background: var(--brand-primary-dark); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary.fb { background: var(--fb-color); }
.btn-primary.yt { background: var(--yt-color); }
.btn-ghost { background: var(--bg-panel); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--brand-primary-light); border-color: var(--brand-primary); }
.btn-danger { background: white; color: var(--danger); border: 1px solid var(--danger-bg); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-danger:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-block { width: 100%; margin-top: 8px; }
.btn-sm { padding: 6px 12px; font-size: 0.8rem; }

/* ---------- Cards / panels ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 16px; }
.panel, .form-card, .auth-card {
    background: var(--bg-panel); border-radius: var(--radius-md);
    box-shadow: var(--shadow-card); border: 1px solid var(--border-color);
    padding: 22px;
}
.stream-card {
    display: block; color: var(--text-primary);
    background: var(--bg-panel); border-radius: var(--radius-md);
    box-shadow: var(--shadow-card); border: 1px solid var(--border-color);
    overflow: hidden; transition: box-shadow 0.15s, transform 0.15s;
}
.stream-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.stream-card-thumb {
    height: 130px; background-size: cover; background-position: center;
    background-color: var(--brand-primary-light);
}
.stream-card-thumb-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-primary);
}
.stream-card-thumb-placeholder span { color: white; font-size: 2.2rem; font-weight: 700; opacity: 0.85; }
.stream-card-body { padding: 16px; }
.stream-card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.stream-card-date { font-size: 0.72rem; color: var(--text-secondary); white-space: nowrap; }
.stream-card-platforms { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }

.form-card { max-width: 560px; }
.form-card label { display: block; font-size: 0.82rem; font-weight: 600; margin: 16px 0 6px; }
.form-card label:first-of-type { margin-top: 0; }

.stream-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
    gap: 18px;
    align-items: start;
    width: 100%;
}
@media (max-width: 800px) { .stream-detail-grid { grid-template-columns: minmax(0, 1fr); } }
.detail-col { min-width: 0; }

/* ---------- Live preview player ---------- */
.player-panel { margin-bottom: 18px; }
.player-wrap {
    width: 100%; aspect-ratio: 16 / 9; background: #0F172A;
    border-radius: var(--radius-md); overflow: hidden;
    box-shadow: var(--shadow-card);
}
.player-wrap video { width: 100%; height: 100%; object-fit: contain; background: #0F172A; }
.player-hint { margin-top: 8px; }
.player-hint code { background: #F3F4F6; padding: 1px 5px; border-radius: 4px; font-size: 0.78rem; }

/* ---------- Tab bar (comments) ---------- */
.tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border-color); margin-bottom: 14px; overflow-x: auto; }
.tab {
    padding: 8px 14px; border: none; background: none; cursor: pointer;
    font-size: 0.85rem; font-weight: 600; color: var(--text-secondary);
    border-bottom: 2px solid transparent; white-space: nowrap; flex-shrink: 0;
}
.tab:hover { color: var(--text-primary); }
.tab-active { color: var(--brand-primary); border-bottom-color: var(--brand-primary); }

.code-box-wrap { white-space: pre-wrap !important; word-break: break-word; overflow-wrap: anywhere; }

/* ---------- Auth card ---------- */
.auth-card { max-width: 380px; width: 100%; }
.auth-brand { text-align: center; margin-bottom: 22px; }
.auth-brand h1 { margin-top: 12px; font-size: 1.3rem; }
.auth-subtitle { color: var(--text-secondary); font-size: 0.85rem; margin-top: 4px; }

/* ---------- Form controls ---------- */
.input {
    width: 100%; padding: 9px 13px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-color); font-size: 0.875rem; font-family: inherit;
}
.input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 3px var(--brand-primary-light); }
.textarea { resize: vertical; }
.checkbox-row { display: flex; gap: 24px; margin: 16px 0; font-size: 0.875rem; }
.divider { border: none; border-top: 1px solid var(--border-color); margin: 20px 0; }

/* ---------- Status / badges ---------- */
.status-pill {
    display: inline-block; padding: 3px 10px; border-radius: 999px;
    font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.status-draft { background: #F3F4F6; color: #4B5563; }
.status-live { background: var(--danger-bg); color: var(--danger); animation: pulse 2s infinite; }
.status-ended { background: #F3F4F6; color: #4B5563; }
.status-failed { background: var(--warning-bg); color: var(--warning); }
.status-active { background: var(--success-bg); color: var(--success); }
.status-suspended { background: var(--warning-bg); color: var(--warning); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

.platform-badge { padding: 2px 8px; border-radius: 6px; font-size: 0.68rem; font-weight: 700; color: white; }
.platform-badge.fb { background: var(--fb-color); }
.platform-badge.yt { background: var(--yt-color); }
.platform-badge.own { background: var(--own-color); }
.platform-link { display: block; margin-top: 4px; font-weight: 600; font-size: 0.85rem; }
.platform-link.fb { color: var(--fb-color); }
.platform-link.yt { color: var(--yt-color); }

.platform-go-live-row { display: flex; flex-direction: column; gap: 12px; }
.platform-go-live-item { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.connection-actions { display: flex; gap: 8px; margin-top: 8px; }

/* ---------- Alerts ---------- */
.alert-error, .alert-warning, .alert-success {
    padding: 10px 14px; border-radius: var(--radius-sm); font-size: 0.85rem; margin: 12px 0;
}
.alert-error { background: var(--danger-bg); color: var(--danger); }
.alert-warning { background: var(--warning-bg); color: var(--warning); }
.alert-success { background: var(--success-bg); color: var(--success); }

/* ---------- Misc ---------- */
.copy-row { display: flex; gap: 8px; align-items: center; min-width: 0; }
.code-box {
    flex: 1; min-width: 0; background: #F3F4F6; padding: 9px 12px; border-radius: var(--radius-sm);
    font-family: 'SF Mono', Consolas, monospace; font-size: 0.78rem; overflow-x: auto; white-space: nowrap;
}
.callout { background: var(--brand-primary-light); padding: 13px; border-radius: var(--radius-sm); margin: 16px 0; font-size: 0.85rem; }
.thumb-preview { max-width: 220px; border-radius: var(--radius-sm); margin-top: 10px; display: block; }
.page-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid var(--border-color); border-radius: var(--radius-sm); margin-top: 8px; cursor: pointer; font-size: 0.9rem; }
.page-option:hover { background: var(--brand-primary-light); border-color: var(--brand-primary); }
.connected-as { color: var(--success); }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-secondary); }

.comments-panel { max-height: 600px; display: flex; flex-direction: column; }
.comment-filter-row { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.chip {
    padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-color);
    background: white; font-size: 0.78rem; font-weight: 600; cursor: pointer; color: var(--text-secondary);
}
.chip-active { background: var(--brand-primary); color: white; border-color: var(--brand-primary); }
.comments-feed { overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.comment-row { display: flex; gap: 10px; align-items: flex-start; }
.comment-avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.comment-avatar-placeholder {
    display: flex; align-items: center; justify-content: center;
    background: var(--brand-primary-light); color: var(--brand-primary); font-weight: 700; font-size: 0.85rem;
}
.comment-body { flex: 1; min-width: 0; }
.comment-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.comment-time { font-size: 0.72rem; color: var(--text-secondary); }
.comment-row p { margin: 3px 0 0; font-size: 0.875rem; }

.table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-color); font-size: 0.875rem; }
.table th { color: var(--text-secondary); font-weight: 600; font-size: 0.72rem; text-transform: uppercase; }

/* ---------- Modal (delete confirmation etc) ---------- */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,0.45);
    backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-card {
    background: white; border-radius: var(--radius-md); padding: 24px;
    max-width: 420px; width: 90%; box-shadow: 0 12px 32px rgba(0,0,0,0.2);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

