/* ============================================================
   BINGURU TV — clean, utilitarian, modern
   IBM Plex Sans + IBM Plex Mono, small type, minimal chrome
   ============================================================ */

:root {
    --bg: #FAF9F6;
    --bg-raised: #f1efe9;
    --fg: #111111;
    --fg-soft: #2e2e2e;
    --muted: #6f6f6c;
    --muted-soft: #9a9a97;
    --line: rgba(17, 17, 17, 0.10);
    --line-strong: rgba(17, 17, 17, 0.22);
    --accent: #d94a2b;
    --accent-soft: rgba(217, 74, 43, 0.16);

    --sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

    --radius: 4px;
    --pad: clamp(16px, 3vw, 28px);
    --shell-max: 880px;
}

[data-theme="dark"] {
    --bg: #1a1a1a;
    --bg-raised: #232323;
    --fg: #f1f1ee;
    --fg-soft: #d4d4d0;
    --muted: #9a9a97;
    --muted-soft: #6a6a67;
    --line: rgba(241, 241, 238, 0.12);
    --line-strong: rgba(241, 241, 238, 0.24);
    --accent: #ef5a3b;
    --accent-soft: rgba(239, 90, 59, 0.18);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    transition: background-color 240ms ease, color 240ms ease;
}

.iptv-page { min-height: 100vh; }

.iptv-shell {
    max-width: var(--shell-max);
    margin: 0 auto;
    padding: clamp(14px, 2.5vw, 24px) var(--pad) clamp(48px, 6vw, 72px);
}

/* ---------- Top bar ---------- */
.iptv-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0 18px;
}

.iptv-topbar-link {
    color: var(--muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: color 160ms ease;
}
.iptv-topbar-link:hover { color: var(--fg); }

.iptv-topbar-arrow {
    display: inline-block;
    transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.iptv-topbar-link:hover .iptv-topbar-arrow { transform: translateX(-3px); }

.iptv-theme-toggle {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--muted);
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    text-transform: lowercase;
    letter-spacing: 0.04em;
    padding: 4px 10px;
    border-radius: var(--radius);
    cursor: pointer;
    transition: color 160ms ease, border-color 160ms ease, background-color 160ms ease;
}
.iptv-theme-toggle:hover {
    color: var(--fg);
    border-color: var(--line-strong);
}

/* ---------- Selectors ---------- */
.iptv-selectors {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.iptv-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.iptv-field-label {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.iptv-select-wrap {
    position: relative;
}

.iptv-select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    color: var(--fg);
    font-family: var(--sans);
    font-size: 14px;
    font-weight: 500;
    padding: 10px 34px 10px 12px;
    cursor: pointer;
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.iptv-select:hover:not(:disabled) {
    border-color: var(--line-strong);
}
.iptv-select:focus-visible:not(:disabled) {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.iptv-select:disabled {
    color: var(--muted);
    cursor: not-allowed;
    opacity: 0.7;
}
.iptv-select option {
    color: var(--fg);
    background: var(--bg);
}

.iptv-select-caret {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-55%);
    pointer-events: none;
    color: var(--muted);
    font-size: 11px;
    line-height: 1;
}

/* ---------- Viewport ---------- */
.iptv-viewport-frame {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #000;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}

.iptv-video {
    width: 100%;
    height: 100%;
    display: block;
    background: #000;
}

.iptv-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--muted);
    text-align: center;
    padding: 24px;
    background: var(--bg-raised);
}
.iptv-placeholder-mark {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 3px 8px;
    border: 1px solid var(--line-strong);
    border-radius: 2px;
    color: var(--muted);
}
.iptv-placeholder-hint {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--muted);
}

.iptv-watermark {
    position: absolute;
    bottom: 10px;
    right: 12px;
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: rgba(255, 255, 255, 0.6);
    pointer-events: none;
    mix-blend-mode: difference;
    z-index: 1;
}

/* ---------- Control row ---------- */
.iptv-control-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 0 0;
    flex-wrap: wrap;
}

.iptv-play {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line-strong);
    background: var(--bg-raised);
    color: var(--fg);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: var(--radius);
    transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
    flex-shrink: 0;
}
.iptv-play:hover:not(:disabled) {
    background: var(--fg);
    color: var(--bg);
    border-color: var(--fg);
}
.iptv-play:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}
.iptv-play-icon {
    display: inline-block;
    line-height: 1;
    font-size: 11px;
    transform: translateX(1px);
}

.iptv-volume {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1 1 200px;
    min-width: 160px;
    max-width: 260px;
}
.iptv-volume-label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    flex-shrink: 0;
}

.iptv-volume-slider {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    width: 100%;
    height: 18px;
    cursor: pointer;
    margin: 0;
}
.iptv-volume-slider::-webkit-slider-runnable-track {
    height: 2px;
    background: var(--line-strong);
    border-radius: 2px;
}
.iptv-volume-slider::-moz-range-track {
    height: 2px;
    background: var(--line-strong);
    border: none;
    border-radius: 2px;
}
.iptv-volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 12px;
    background: var(--fg);
    border: none;
    border-radius: 50%;
    margin-top: -5px;
    cursor: pointer;
    transition: transform 160ms ease;
}
.iptv-volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    background: var(--fg);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 160ms ease;
}
.iptv-volume-slider:hover::-webkit-slider-thumb { transform: scale(1.2); }
.iptv-volume-slider:hover::-moz-range-thumb     { transform: scale(1.2); }
.iptv-volume-slider:focus-visible { outline: none; }
.iptv-volume-slider:focus-visible::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px var(--accent-soft);
}

.iptv-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

.iptv-status-indicator {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--muted-soft);
    display: inline-block;
    flex-shrink: 0;
    transition: background-color 240ms ease, box-shadow 240ms ease;
}
.iptv-status-indicator.loading {
    background: var(--accent);
    animation: iptv-pulse 1.3s ease-in-out infinite;
}
.iptv-status-indicator.playing {
    background: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.iptv-status-indicator.error { background: var(--fg); }
.iptv-status-indicator.ready { background: var(--muted-soft); }

@keyframes iptv-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%      { opacity: 0.35; transform: scale(0.8); }
}

.iptv-status-text { color: var(--fg-soft); }

.iptv-cancel-load {
    margin-left: 8px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 4px 10px;
    cursor: pointer;
    transition: background-color 160ms ease;
}
.iptv-cancel-load:hover { background: #c43d1f; }
[data-theme="dark"] .iptv-cancel-load:hover { background: #d94a2b; }

/* ---------- Now playing ---------- */
.iptv-now {
    padding: 20px 0 4px;
}
.iptv-now-label {
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--muted);
    margin-bottom: 4px;
}
.iptv-channel-name {
    font-family: var(--sans);
    font-size: 20px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -0.01em;
    color: var(--fg);
    margin: 0;
    word-break: break-word;
}

/* ---------- Notes ---------- */
.iptv-notes {
    margin-top: 32px;
    padding-top: 20px;
    border-top: 1px solid var(--line);
}
.iptv-notes-list {
    margin: 0;
    padding: 0;
    list-style: none;
    display: grid;
    gap: 6px;
    font-size: 12.5px;
    line-height: 1.55;
    color: var(--muted);
    max-width: 560px;
}
.iptv-notes-list li {
    padding-left: 14px;
    position: relative;
}
.iptv-notes-list li::before {
    content: "·";
    position: absolute;
    left: 2px;
    color: var(--muted-soft);
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
    .iptv-selectors { grid-template-columns: 1fr; gap: 12px; }
    .iptv-volume {
        order: 3;
        flex-basis: 100%;
        max-width: none;
    }
    .iptv-status { margin-left: 0; }
    .iptv-channel-name { font-size: 18px; }
}

/* ---------- Load-in (subtle) ---------- */
@media (prefers-reduced-motion: no-preference) {
    .iptv-shell { animation: iptv-fade 320ms ease-out both; }
}
@keyframes iptv-fade {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

::selection {
    background: var(--accent);
    color: #fff;
}
