/* =========================================
   PSYB.IN PLAYER
   Main layout and visual styling
   ========================================= */

/* ---------- Theme ---------- */

:root {
    color-scheme: dark;

    --background: #111116;
    --surface: #191920;
    --surface-raised: #22222c;

    --border: #30303b;

    --text-primary: #eeeeF5;
    --text-secondary: #92929f;
    --text-muted: #666674;

    --accent: #8b7cf6;
    --accent-hover: #a397ff;
    --accent-glow: rgba(139, 124, 246, 0.25);

    --danger: #ef626c;
    --success: #55d69a;

    --player-radius: 12px;

    --transition-fast: 150ms ease;
    --transition-normal: 250ms ease;
}


/* ---------- Reset ---------- */

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    min-height: 100%;
    background: var(--background);
}

body {
    margin: 0;
    min-height: 100vh;

    background:
        radial-gradient(
            ellipse at 50% -20%,
            rgba(139, 124, 246, 0.07),
            transparent 65%
        ),
        var(--background);

    color: var(--text-primary);

    font-family:
        Inter,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    -webkit-font-smoothing: antialiased;
}


/* ---------- Page Layout ---------- */

.player-page {
    width: min(1200px, 100%);
    min-height: 100vh;

    margin: 0 auto;
    padding: 24px 32px;

    display: flex;
    flex-direction: column;
}


/* ---------- Header ---------- */

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

    gap: 20px;

    padding: 8px 0 22px;

    border-bottom: 1px solid var(--border);
}

.player-brand {
    display: flex;
    align-items: center;
    gap: 10px;

    white-space: nowrap;
}

.brand-name {
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 2.5px;

    color: var(--text-primary);
}

.brand-divider {
    color: var(--accent);
    font-size: 18px;
}

.brand-section {
    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;
    letter-spacing: 2px;
}


/* ---------- Playback Modes ---------- */

.playback-modes {
    display: flex;
    align-items: center;
    gap: 4px;

    padding: 4px;

    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 9px;
}

.mode-button {
    padding: 8px 15px;

    border: none;
    border-radius: 6px;

    background: transparent;
    color: var(--text-secondary);

    font-size: 12px;
    font-weight: 600;

    cursor: pointer;

    transition:
        background var(--transition-fast),
        color var(--transition-fast);
}

.mode-button:hover {
    color: var(--text-primary);
}

.mode-button.active {
    background: var(--surface-raised);
    color: var(--accent-hover);
    box-shadow: 0 0 12px rgba(139, 124, 246, 0.08);
}


/* ---------- Player Container ---------- */

.player-container {
    width: 100%;

    margin: 32px auto 0;

    overflow: hidden;

    background: #08080b;

    border: 1px solid var(--border);
    border-radius: var(--player-radius);

    box-shadow:
        0 16px 50px rgba(0, 0, 0, 0.3),
        0 0 30px rgba(139, 124, 246, 0.035);
}

.video-wrapper {
    position: relative;

    width: 100%;
    aspect-ratio: 16 / 9;

    overflow: hidden;

    background: #08080b;
}

.video-element {
    display: block;

    width: 100%;
    height: 100%;

    object-fit: contain;

    background: #08080b;
}


/* ---------- Loading Indicator ---------- */

.player-loading {
    position: absolute;
    inset: 0;

    display: flex;
    align-items: center;
    justify-content: center;

    background: rgba(8, 8, 11, 0.45);

    pointer-events: none;
}

.player-loading[hidden] {
    display: none;
}

.loading-spinner {
    width: 42px;
    height: 42px;

    border: 3px solid rgba(255, 255, 255, 0.12);
    border-top-color: var(--accent);

    border-radius: 50%;

    animation: player-spin 800ms linear infinite;

    box-shadow: 0 0 18px var(--accent-glow);
}

@keyframes player-spin {
    to {
        transform: rotate(360deg);
    }
}


/* ---------- Error Overlay ---------- */

.player-error {
    position: absolute;
    inset: 0;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    gap: 10px;

    padding: 24px;

    background: rgba(8, 8, 11, 0.94);

    text-align: center;
}

.player-error[hidden] {
    display: none;
}

.error-title {
    color: var(--danger);

    font-size: 17px;
    font-weight: 700;
}

.error-description {
    max-width: 400px;

    color: var(--text-secondary);

    font-size: 13px;
    line-height: 1.6;
}


/* ---------- Live Indicator ---------- */

.live-indicator {
    position: absolute;
    top: 18px;
    left: 18px;

    display: flex;
    align-items: center;
    gap: 8px;

    padding: 7px 11px;

    background: rgba(15, 15, 20, 0.85);
    border: 1px solid rgba(239, 98, 108, 0.3);
    border-radius: 6px;

    color: #ff858d;

    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
}

.live-indicator[hidden] {
    display: none;
}

.live-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--danger);

    box-shadow: 0 0 10px rgba(239, 98, 108, 0.7);

    animation: live-pulse 1.8s ease-in-out infinite;
}

@keyframes live-pulse {
    50% {
        opacity: 0.4;
    }
}


/* ---------- Footer / Status ---------- */

.player-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;

    gap: 16px;

    margin-top: 16px;
    padding: 0 4px;
}

.player-status {
    display: flex;
    align-items: center;
    gap: 9px;

    color: var(--text-secondary);

    font-size: 12px;
}

.status-dot {
    width: 7px;
    height: 7px;

    border-radius: 50%;

    background: var(--text-muted);

    transition: background var(--transition-normal);
}

.player-status[data-state="ready"] .status-dot {
    background: var(--success);
}

.player-status[data-state="loading"] .status-dot {
    background: var(--accent);
    box-shadow: 0 0 9px var(--accent-glow);
}

.player-status[data-state="error"] .status-dot {
    background: var(--danger);
}

.player-version {
    color: var(--text-muted);

    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.5px;
}

.player-container:fullscreen {
	width: 100%;
	height: 100%;
	margin: 0;
	border: none;
	border-radius: 0;
}

.player-container:fullscreen .video-wrapper {
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
}

/* ---------- Accessibility ---------- */

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}


/* ---------- Responsive Layout ---------- */

@media (max-width: 600px) {

    .player-page {
        padding: 16px 12px;
    }

    .player-header {
        gap: 12px;
        flex-wrap: wrap;
    }

    .brand-name {
        font-size: 13px;
    }

    .brand-section {
        font-size: 10px;
    }

    .mode-button {
        padding: 7px 10px;
        font-size: 11px;
    }

    .player-container {
        margin-top: 20px;
        border-radius: 8px;
    }

    .player-footer {
        margin-top: 12px;
    }

}
