/* DEPLOYMENT: __BUILD_DEPLOYMENT__ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --color-primary: rgb(99, 115, 235);
    --color-primary-hover: rgb(115, 130, 245);
    --color-text: rgb(230, 230, 235);
    --color-text-muted: rgb(120, 120, 130);
    --color-border: rgb(50, 50, 58);
    --color-bg-surface: rgb(26, 26, 30);
    --color-bg-deep: rgb(10, 10, 12);
    --color-bg-card: rgb(46, 46, 52);
    --color-danger: rgb(235, 80, 80);
    --color-success: rgb(90, 190, 95);
    --color-warning: rgb(240, 180, 90);
    --shadow-popup: 0 4px 24px rgba(0, 0, 0, 0.4);
    --radius-container: 15px;
    --radius-menu: 10px;
    --radius-input: 8px;
    --font-mono: 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, monospace;
}

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg-deep);
    min-height: 100vh;
    color: var(--color-text);
    overflow: hidden;
}

/* Hide mouse cursor in player state */
body.player-hide-cursor {
    cursor: none !important;
}

/* App Container */
#app {
    width: 100vw;
    height: 100vh;
    position: relative;
}

/* Screen States */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 0;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease-in-out;
    pointer-events: none;
}

.screen.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Container — vmin-based scaling for orientation-independent sizing
   max() floor prevents text from being too small on close-viewing devices (retina Macs) */
.container {
    font-size: max(1.85vmin, 16px);
    width: fit-content;
    min-width: max(38vmin, 340px);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--color-bg-surface);
    border-radius: 0.8em;
    padding: 3em 5em;
    box-shadow: var(--shadow-popup);
    border: 1px solid var(--color-border);
}

/* Player State Styles */
#player-screen {
    background: #000;
    overflow: hidden;
    align-items: stretch;
    padding-top: 0;
}

#player-container {
    width: 100vw;
    height: 100vh;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-item {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
}

.content-item.active {
    opacity: 1;
}

/* Double buffer: back buffer is hidden, waiting for swap.
   Matches OptiSigns: visibility:hidden + opacity:0 + z-index:-1000.
   Combined with delayed preload (max 3s in DOM), this avoids the Android WebView
   SurfaceView compositor issue (video goes black after ~4s of overlapping layers).
   Do NOT use translateX or z-index on .active — breaks SurfaceView rendering. */
.content-item.buffer-back {
    visibility: hidden;
    opacity: 0;
    z-index: -1000;
    pointer-events: none;
}

.content-video,
.content-iframe {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border: none;
}

.content-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.content-web {
    width: 100%;
    height: 100%;
    border: none;
}

.content-app {
    width: 100%;
    height: 100%;
    border: none;
    object-fit: cover;
}

/* Player loading overlay */
#player-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    color: white;
}

#player-loading-overlay.hidden {
    display: none;
}

/* Player debug info */
#player-debug-info {
    position: fixed;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 12px;
    z-index: 999;
    display: none;
}

#player-debug-info.show {
    display: block;
}

/* Logo */
.logo {
    width: 100%;
}

.logo-image {
    max-width: max(25vmin, 200px);
    height: auto;
    margin-bottom: 1.4em;
}

.logo h1 {
    font-size: 1.8em;
    font-weight: 700;
    margin-bottom: 0.4em;
    color: var(--color-text);
}

.logo p {
    color: var(--color-text-muted);
    font-size: 0.75em;
    margin-bottom: 1.6em;
}

/* Pairing Sections */
.pairing-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
    transition: all 0.3s ease-in-out;
}

.pairing-section.hidden {
    display: none;
    opacity: 0;
    transform: translateY(-10px);
}

.pairing-section h2 {
    font-size: 1.3em;
    margin-bottom: 0.8em;
    color: var(--color-text);
}

.pairing-section p {
    color: var(--color-text-muted);
    margin-bottom: 1.2em;
    line-height: 1.5;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4em;
    padding: 0.8em 1.6em;
    border: none;
    border-radius: 0.4em;
    font-size: 0.75em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    min-width: 10em;
}

.btn-primary {
    background: var(--color-primary);
    color: white;
    box-shadow: none;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Pairing Code */
.pairing-code {
    font-size: 1.4em;
    font-weight: 700;
    letter-spacing: 0.3em;
    color: var(--color-text);
    background: var(--color-bg-card);
    border: 1.5px solid var(--color-primary);
    border-radius: 0.5em;
    padding: 0.5em 0.6em;
    margin: 0;
    font-family: var(--font-mono);
}

.pairing-code--paired {
    color: var(--color-success);
    border-color: var(--color-success);
    background: rgba(90, 190, 95, 0.1);
}

/* Pairing Instructions */
.pairing-instructions {
    font-size: 0.7em;
    color: var(--color-text-muted);
    margin-bottom: 0.8em;
}

/* QR Code Layout */
.pairing-layout {
    display: flex;
    align-items: center;
    gap: 1.6em;
}

.pairing-qr {
    background: #fff;
    padding: 0.7em;
    border-radius: 0.6em;
    flex-shrink: 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
}

.pairing-qr img {
    display: block;
    width: 9em;
    height: 9em;
}

/* Hide QR container completely when library unavailable (TV apps) */
.pairing-layout.no-qr {
    justify-content: center;
}

.pairing-layout.no-qr .pairing-qr {
    display: none;
}

.pairing-info {
    flex: 1;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.8em;
}

.pairing-scan-hint {
    font-size: 0.65em;
    color: var(--color-text-muted);
    margin: 0;
    line-height: 1.5;
}

/* Icon Status (replaces emoji icons) */
.icon-status {
    width: 2.4em;
    height: 2.4em;
    margin: 0 auto 1em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-status svg {
    width: 2.4em;
    height: 2.4em;
}

.icon-status--success svg {
    color: var(--color-success);
}

.icon-status--warning svg {
    color: var(--color-warning);
}

.icon-status--danger svg {
    color: var(--color-danger);
}

/* Status Dot (replaces text badges) */
.status-dot {
    width: 0.4em;
    height: 0.4em;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.3em;
}

.status-dot--connected {
    background: var(--color-success);
}

.status-dot--disconnected {
    background: var(--color-danger);
}

.status-dot--connecting {
    background: var(--color-warning);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Success States */
.success-icon {
    font-size: 2.4em;
    margin-bottom: 1em;
    animation: bounce 1s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

.success-details {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 0.4em;
    padding: 1em;
    margin: 1em 0;
    text-align: left;
}

.success-details p {
    margin-bottom: 0.4em;
    font-size: 0.7em;
    color: var(--color-text-muted);
}

.success-details strong {
    color: var(--color-text);
    font-weight: 600;
}

.status-paired {
    color: var(--color-success);
    font-weight: 600;
}

.status-active {
    color: var(--color-primary);
    font-weight: 600;
}

.loading-info {
    font-size: 0.7em;
    color: var(--color-text-muted);
    margin-top: 0.8em;
}

.status-info {
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: 0.4em;
    padding: 0.8em;
    margin: 1em 0;
    text-align: left;
}

.status-info p {
    margin-bottom: 0.4em;
    font-size: 0.65em;
    color: var(--color-text-muted);
}

/* Connection Info (status dot + "Verbonden") */
.connection-info {
    font-size: 0.85em;
    color: var(--color-text-muted);
    margin-top: 0.8em;
}

/* Device ID */
.device-id-info {
    font-size: 0.65em;
    color: var(--color-text-muted);
    font-family: var(--font-mono);
    opacity: 0.4;
    margin-top: 1.5em;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 0.4em;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 0.2em;
    overflow: hidden;
    margin: 1em 0;
}

.progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 0.2em;
    width: 0%;
    transition: width 0.3s ease;
}

.loading-status {
    font-size: 0.7em;
    color: var(--color-text-muted);
}

/* Spinners */
.spinner {
    width: 2em;
    height: 2em;
    border: 0.2em solid rgba(255, 255, 255, 0.2);
    border-top: 0.2em solid var(--color-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 1em auto;
}

.spinner.small {
    width: 1.2em;
    height: 1.2em;
    border-width: 0.15em;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error States */
.error-icon {
    font-size: 2.4em;
    margin-bottom: 1em;
}

#error-message {
    color: var(--color-danger);
    margin-bottom: 1.2em;
}

/* Status Messages */
.status {
    color: var(--color-text-muted);
    font-size: 0.7em;
    margin-top: 0.8em;
}

/* Connection Status */
.connection-status {
    display: inline-block;
    font-size: 0.6em;
    font-weight: 500;
    color: var(--color-text-muted);
    transition: all 0.3s ease;
}

.connection-status.online {
    color: var(--color-success);
}

.connection-status.offline {
    color: var(--color-danger);
}

.connection-status.paired {
    color: var(--color-success);
    font-weight: 600;
}

/* Small viewport fallback (phones viewing player URL directly) */
@media (max-width: 640px) {
    .container {
        font-size: 3vmin;
        width: 85vmin;
        margin: 2em auto;
    }

    .pairing-layout {
        flex-direction: column;
        gap: 1.2em;
    }
}

    .success-icon {
        font-size: 3rem;
        margin-bottom: 16px;
    }
}

/* Hide elements during loading */
.loading #pairing-screen,
.loading #error-screen {
    pointer-events: none;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .screen {
        transition: opacity 0.3s ease;
        transform: none;
    }

    .spinner {
        animation: none;
        border-top-color: var(--color-primary);
    }

    .success-icon {
        animation: none;
    }
}

/* Success feedback animations */
.pairing-success-section {
    animation: slideInUp 0.5s ease-out;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* PROFESSIONAL DEBUG OVERLAY */
.debug-overlay {
    position: fixed;
    bottom: 20px;
    left: 20px;
    background: rgba(0, 0, 0, 0.9);
    padding: 16px 20px;
    border-radius: var(--radius-menu);
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-text);
    z-index: 9999;
    display: none;
    box-shadow: var(--shadow-popup);
    border: 1px solid var(--color-border);
    min-width: 320px;
    max-width: 400px;
    line-height: 1.5;
}

.debug-overlay.show {
    display: block;
    animation: debugFadeIn 0.3s ease-out;
}

@keyframes debugFadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Debug content styling */
.debug-header {
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.debug-section {
    margin-bottom: 10px;
}

.debug-section:last-child {
    margin-bottom: 0;
}

.debug-label {
    font-size: 10px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.debug-value {
    color: var(--color-text);
    font-size: 11px;
    word-break: break-all;
}

.debug-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 10px;
}

.debug-cell {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 8px;
}

.debug-text-success {
    color: var(--color-success);
}

.debug-text-danger {
    color: var(--color-danger);
}

.debug-text-warning {
    color: var(--color-warning);
}

.debug-text-version {
    color: var(--color-success);
    font-weight: 600;
}

/* Responsive for smaller screens */
@media (max-width: 640px) {
    .debug-overlay {
        bottom: 10px;
        left: 10px;
        right: 10px;
        min-width: auto;
        max-width: none;
        font-size: 11px;
    }

    .debug-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

/* Notification styles */
.pairing-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    padding: 16px 20px;
    border-radius: var(--radius-input);
    font-size: 14px;
    max-width: 300px;
    box-shadow: var(--shadow-popup);
    transition: opacity 0.3s ease;
}

.pairing-notification--error {
    background: rgba(235, 80, 80, 0.15);
    color: var(--color-danger);
    border: 1px solid rgba(235, 80, 80, 0.3);
}

.pairing-notification--success {
    background: rgba(90, 190, 95, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(90, 190, 95, 0.3);
}

.pairing-notification--info {
    background: rgba(99, 115, 235, 0.15);
    color: var(--color-primary);
    border: 1px solid rgba(99, 115, 235, 0.3);
}

/* Offline indicator */
.offline-indicator {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text);
    padding: 8px 16px;
    border-radius: var(--radius-input);
    font-size: 13px;
    font-family: 'Inter', system-ui, sans-serif;
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.content-audio {
    display: none; /* Audio element hidden, wrapper provides visual */
}

/* === SEAMLESS CONTENT TRANSITIONS STYLING === */

/* Download Progress */
.download-overlay-subtle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.85);
    border-radius: var(--radius-menu);
    padding: 12px 16px;
    z-index: 1500;
    opacity: 1;
    transition: all 0.3s ease;
    border: 1px solid var(--color-border);
    max-width: 280px;
    box-shadow: var(--shadow-popup);
}

.download-overlay-subtle.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
}

.download-content-subtle {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.download-icon {
    font-size: 20px;
    animation: downloadBounce 2s ease-in-out infinite;
}

@keyframes downloadBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-2px); }
}

.download-text {
    flex: 1;
    min-width: 0;
}

.download-message {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.download-progress-mini {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 4px;
}

.download-progress-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
}

.download-percentage {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
    text-align: right;
}

/* Responsive */
@media (max-width: 768px) {
    .download-overlay-subtle {
        bottom: 15px;
        right: 15px;
        max-width: 220px;
        padding: 10px 12px;
    }

    .download-message {
        font-size: 11px;
    }

    .download-percentage {
        font-size: 9px;
    }
}

/* Seamless Transition Effects */
.seamless-transition {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.seamless-transition.entering {
    opacity: 0;
    transform: scale(0.95);
}

.seamless-transition.entered {
    opacity: 1;
    transform: scale(1);
}

.seamless-transition.exiting {
    opacity: 0;
    transform: scale(1.05);
}

/* Enhanced Loading States */
.content-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 1.1rem;
    z-index: 10;
}

.content-loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: contentLoadingSpin 1s linear infinite;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes contentLoadingSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Enhanced Error States for Seamless Transitions */
.content-error {
    background: linear-gradient(135deg, #1a1a1a 0%, #2d1b2d 100%);
    border: 2px solid rgba(255, 107, 107, 0.3);
}

.content-error.transitioning {
    animation: errorPulse 2s ease-in-out infinite alternate;
}

@keyframes errorPulse {
    0% {
        border-color: rgba(255, 107, 107, 0.3);
        box-shadow: 0 0 0 0 rgba(255, 107, 107, 0.4);
    }
    100% {
        border-color: rgba(255, 107, 107, 0.6);
        box-shadow: 0 0 0 10px rgba(255, 107, 107, 0);
    }
}

/* GPU compositing is applied via .transition-active class in transition-manager.js
   to avoid texture tiling artifacts on large/high-res images */

/* Trigger zone top-right corner — reveals toolbar when mouse enters.
   Large enough to find easily, small enough to not interfere with content. */
#sb-toolbar-trigger {
    position: fixed;
    top: 0;
    right: 0;
    width: 300px;
    height: 50px;
    z-index: 1599;
    pointer-events: auto;
}

/* ===== SETTINGS TOOLBAR (top-right, hover to show) ===== */
#sb-player-toolbar {
    position: fixed;
    top: 16px;
    right: 18px;
    z-index: 1600;
    display: flex;
    flex-direction: row;
    gap: 6px;
    padding: 8px;
    background: rgba(49, 49, 54, 0.92);
    border: 1px solid rgba(88, 88, 92, 0.6);
    border-radius: 12px;
    opacity: 0;
    pointer-events: auto;
    transition: opacity 0.25s;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#sb-player-toolbar.visible {
    opacity: 1;
}

#sb-player-toolbar button {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    padding: 0;
    transition: background 0.15s;
}

#sb-player-toolbar button:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(88, 88, 92, 0.6);
}

/* ===== SETTINGS PANEL (slides from left) ===== */
#sb-settings-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 420px;
    height: 100%;
    z-index: 1700;
    background: rgb(38, 38, 42);
    border-right: 1px solid rgb(88, 88, 92);
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    overflow-y: auto;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--color-text);
}

#sb-settings-panel.open {
    transform: translateX(0);
}

#sb-settings-panel::-webkit-scrollbar {
    width: 0;
    display: none;
}

#sb-settings-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1650;
    background: rgba(0, 0, 0, 0.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}

#sb-settings-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* Settings panel internal styles */
.sb-settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.sb-settings-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.sb-settings-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
}

.sb-settings-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.sb-info-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 13px;
}

.sb-info-label {
    color: var(--color-text-muted);
}

.sb-divider {
    height: 1px;
    background: rgb(62, 62, 68);
    margin: 12px 0;
}

.sb-btn {
    width: 100%;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid rgb(62, 62, 68);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text);
    background: rgb(49, 49, 54);
    text-align: center;
    transition: background 0.15s;
    font-family: inherit;
    white-space: nowrap;
}

.sb-btn:hover {
    background: rgb(62, 62, 68);
}

/* D-pad focus style for TV platforms (replaces ugly orange browser default) */
.sb-btn:focus,
.sb-btn.sb-dpad-focus {
    outline: none;
    background: rgb(62, 62, 68);
    border-color: var(--color-primary);
    box-shadow: 0 0 0 2px var(--color-primary);
}

/* Remove default focus outline on all settings panel elements */
#sb-settings-panel *:focus {
    outline: none;
}

#sb-settings-panel select:focus,
#sb-settings-panel input:focus {
    border-color: var(--color-primary);
}

/* Prevent focus ring on backdrop and panel container */
#sb-settings-backdrop:focus,
#sb-settings-panel:focus {
    outline: none;
}

.sb-btn-primary {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.sb-btn-primary:hover {
    background: var(--color-primary-hover);
}

.sb-btn-danger {
    color: rgb(239, 68, 68);
    border-color: rgba(239, 68, 68, 0.3);
}

.sb-select {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid rgb(62, 62, 68);
    font-size: 13px;
    color: var(--color-text);
    background: rgb(49, 49, 54);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2378788A' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    font-family: inherit;
}

.sb-input {
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    border: 1px solid rgb(62, 62, 68);
    font-size: 13px;
    color: var(--color-text);
    background: rgb(49, 49, 54);
    margin-top: 2px;
    box-sizing: border-box;
    font-family: inherit;
}

.sb-input:focus,
.sb-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.sb-section-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

/* Settings toast */
.sb-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(49, 49, 54, 0.95);
    border: 1px solid rgb(88, 88, 92);
    color: var(--color-text);
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    z-index: 1800;
    opacity: 0;
    transition: opacity 0.3s;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

/* Fullscreen icon toggle — controlled via JS class, not :fullscreen pseudo-selector
   (Electron setSimpleFullScreen doesn't reliably trigger :fullscreen/:webkit-full-screen) */
#sb-player-toolbar .fullscreen-icon-compress {
    display: none;
}
#sb-player-toolbar.is-fullscreen .fullscreen-icon-expand {
    display: none;
}
#sb-player-toolbar.is-fullscreen .fullscreen-icon-compress {
    display: block;
}

/* Ensure pointer cursor on interactive elements in fullscreen
   (body.player-hide-cursor sets cursor:none, but buttons should override) */
:fullscreen button,
:fullscreen a,
:fullscreen select,
:fullscreen input,
:fullscreen label[style*="cursor"],
:fullscreen [role="button"] {
    cursor: pointer !important;
}

:-webkit-full-screen button,
:-webkit-full-screen a,
:-webkit-full-screen select,
:-webkit-full-screen input,
:-webkit-full-screen label[style*="cursor"],
:-webkit-full-screen [role="button"] {
    cursor: pointer !important;
}

.download-overlay {
    will-change: opacity;
}

.download-progress-fill {
    will-change: width;
}
