/* ========================================================================
   KoraStats Video Player
   Scope: only the custom KoraStats video player, loading state, empty state,
   player controls, progress bar, and optional timeline markers.
   ======================================================================== */

:root {
    --ksvp-bg: #050912;
    --ksvp-bg-soft: #0b1220;
    --ksvp-panel: rgba(8, 14, 28, 0.88);
    --ksvp-panel-solid: #0b1220;
    --ksvp-border: rgba(255, 255, 255, 0.12);
    --ksvp-border-strong: rgba(255, 255, 255, 0.22);
    --ksvp-text: #ffffff;
    --ksvp-muted: rgba(255, 255, 255, 0.68);
    --ksvp-faint: rgba(255, 255, 255, 0.42);
    --ksvp-primary: #f5c542;
    --ksvp-primary-strong: #ffb703;
    --ksvp-primary-soft: rgba(245, 197, 66, 0.16);
    --ksvp-blue: #1f7aff;
    --ksvp-danger: #ff4d5e;
    --ksvp-radius-lg: 24px;
    --ksvp-radius-md: 16px;
    --ksvp-radius-sm: 10px;
    --ksvp-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
    --ksvp-font-mono: "Inconsolata", "SFMono-Regular", Consolas, monospace;
}

/* ================================
   Player Shell
================================ */
.c-video,
.ks-video-player {
    position: relative;
    width: 100%;
    overflow: hidden;
    background:
        radial-gradient(circle at 18% 12%, rgba(31, 122, 255, 0.22), transparent 30%),
        radial-gradient(circle at 82% 10%, rgba(245, 197, 66, 0.18), transparent 28%),
        linear-gradient(135deg, #040711 0%, #0b1220 52%, #02040a 100%);
    border: 1px solid var(--ksvp-border);
    box-shadow: var(--ksvp-shadow);
    isolation: isolate;
}

.c-video::before,
.ks-video-player::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 42px 42px;
    opacity: 0.35;
    z-index: 1;
}

.c-video .video,
.ks-video-player .video {
    display: block;
    width: 100%;
    min-height: 360px;
    background: #000;
    position: relative;
    z-index: 0;
}

/* ================================
   Empty / Alert State
================================ */
.ks-video-state {
    position: relative;
    min-height: 340px;
    overflow: hidden;
    border: 1px solid var(--ksvp-border);
    background:
        radial-gradient(circle at top left, rgba(31, 122, 255, 0.22), transparent 28%),
        radial-gradient(circle at bottom right, rgba(245, 197, 66, 0.20), transparent 30%),
        linear-gradient(135deg, #070b16 0%, #0d1526 55%, #040711 100%);
    box-shadow: var(--ksvp-shadow);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px;
    color: var(--ksvp-text);
}

.ks-video-state::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 46px 46px;
    opacity: 0.42;
}

.ks-video-state__panel {
    position: relative;
    z-index: 1;
    width: min(520px, 100%);
    padding: 30px;
    border-radius: 22px;
    background: rgba(7, 12, 24, 0.74);
    border: 1px solid var(--ksvp-border-strong);
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(16px);
    text-align: center;
}

.ks-video-state__badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 30px;
    padding: 6px 12px;
    margin-bottom: 18px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--ksvp-muted);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.ks-video-state__icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 18px;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ksvp-primary);
    font-size: 30px;
    background: var(--ksvp-primary-soft);
    border: 1px solid rgba(245, 197, 66, 0.30);
    box-shadow: 0 14px 34px rgba(245, 197, 66, 0.13);
}

.ks-video-state__title {
    margin: 0 0 8px;
    color: var(--ksvp-text);
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.ks-video-state__text {
    max-width: 420px;
    margin: 0 auto;
    color: var(--ksvp-muted);
    font-size: 14px;
    line-height: 1.65;
}

/* ================================
   Loading State
================================ */
.ks-video-loading {
    min-height: 420px;
}

.ks-video-loading__screen {
    position: relative;
    z-index: 1;
    width: min(720px, 100%);
    aspect-ratio: 16 / 9;
    border-radius: var(--ksvp-radius-lg);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.055), transparent 34%),
        radial-gradient(circle at 50% 44%, rgba(245, 197, 66, 0.16), transparent 25%),
        linear-gradient(135deg, rgba(7, 13, 28, 0.96), rgba(3, 6, 14, 0.98));
    border: 1px solid var(--ksvp-border-strong);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.035), 0 26px 80px rgba(0, 0, 0, 0.42);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.ks-video-loading__screen::before {
    content: "";
    position: absolute;
    inset: 10px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.ks-video-loading__screen::after {
    content: "";
    position: absolute;
    left: -30%;
    top: 0;
    width: 34%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
    animation: ksvpScan 2.2s ease-in-out infinite;
}

.ks-video-loading__content {
    position: relative;
    z-index: 2;
    text-align: center;
    padding: 24px;
}

.ks-video-loading__brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 18px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--ksvp-text);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.ks-video-loading__live-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: var(--ksvp-primary);
    box-shadow: 0 0 0 0 rgba(245, 197, 66, 0.7);
    animation: ksvpPulse 1.6s infinite;
}

.ks-video-loader {
    position: relative;
    width: 94px;
    height: 94px;
    margin: 0 auto 20px;
}

.ks-video-loader::before,
.ks-video-loader::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.ks-video-loader::before {
    border: 3px solid rgba(255, 255, 255, 0.12);
}

.ks-video-loader::after {
    border: 3px solid transparent;
    border-top-color: var(--ksvp-primary);
    border-right-color: rgba(31, 122, 255, 0.9);
    filter: drop-shadow(0 0 14px rgba(245, 197, 66, 0.35));
    animation: ksvpSpin 0.95s linear infinite;
}

.ks-video-loader__play {
    position: absolute;
    inset: 22px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ksvp-primary);
    font-size: 20px;
}

.ks-video-loading__title {
    margin: 0 0 6px;
    color: var(--ksvp-text);
    font-size: 22px;
    font-weight: 800;
}

.ks-video-loading__text {
    margin: 0;
    color: var(--ksvp-muted);
    font-size: 14px;
}

.ks-video-loading__bars {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 20px;
}

.ks-video-loading__bars span {
    width: 34px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
    position: relative;
}

.ks-video-loading__bars span::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, var(--ksvp-primary), var(--ksvp-blue));
    transform: translateX(-110%);
    animation: ksvpBar 1.45s ease-in-out infinite;
}

.ks-video-loading__bars span:nth-child(2)::after { animation-delay: 0.15s; }
.ks-video-loading__bars span:nth-child(3)::after { animation-delay: 0.30s; }

/* ================================
   Controls
================================ */
.c-video .controls,
.ks-video-player .controls {
    position: absolute;
    width: 95%;
    left: 2.5%;
    right: 2.5%;
    bottom: 20px;
    z-index: 5;
    display: flex;
    flex-wrap: wrap;
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(12, 18, 34, 0.78), rgba(3, 7, 16, 0.92));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(16px);
    transform: translateY(calc(100% - 10px));
    transition: transform 220ms ease, opacity 220ms ease;
    opacity: 0.96;
}

.c-video:hover .controls,
.c-video:focus-within .controls,
.ks-video-player:hover .controls,
.ks-video-player:focus-within .controls {
    transform: translateY(0);
    opacity: 1;
}

.c-video .buttons,
.ks-video-player .buttons {
    width: 100%;
    margin: 0;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.c-video .controls button,
.ks-video-player .controls button {
    border-color: rgba(255, 255, 255, 0.22) !important;
    color: var(--ksvp-text) !important;
    background: rgba(255, 255, 255, 0.055) !important;
    box-shadow: none !important;
    transition: transform 140ms ease, background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.c-video .controls button:hover,
.ks-video-player .controls button:hover {
    transform: translateY(-1px);
    color: #111827 !important;
    background: var(--ksvp-primary) !important;
    border-color: var(--ksvp-primary) !important;
}

.c-video .controls .basic,
.ks-video-player .controls .basic {
    width: 2.1rem;
    height: 2.1rem;
    margin-left: 0;
}

.c-video .controls button.time,
.ks-video-player .controls button.time {
    width: 1.75rem;
    height: 1.75rem;
}

.c-video .controls button.use,
.ks-video-player .controls button.use {
    height: 2.1rem;
    padding: 0 11px;
    margin-left: 0;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    border-radius: 999px;
}

.c-video .controls .clock,
.ks-video-player .controls .clock,
.c-video .controls .clip-time,
.ks-video-player .controls .clip-time {
    display: inline-flex;
    align-items: center;
    min-height: 2rem;
    padding: 0 9px;
    border-radius: 999px;
    color: var(--ksvp-text);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: var(--ksvp-font-mono);
    font-size: 12px;
    font-weight: 700;
    margin: 0;
}

.c-video .controls .clip-time,
.ks-video-player .controls .clip-time {
    color: var(--ksvp-primary);
    background: rgba(245, 197, 66, 0.10);
    border-color: rgba(245, 197, 66, 0.18);
}

.c-video .orange-bar,
.ks-video-player .orange-bar {
    position: relative;
    width: 100%;
    height: 11px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.12);
    overflow: hidden;
}

.c-video .orange-bar::after,
.ks-video-player .orange-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 34%, rgba(255, 255, 255, 0.06));
    pointer-events: none;
}

.c-video .orange-juice,
.ks-video-player .orange-juice {
    height: 100%;
    border-radius: 0 999px 999px 0;
    background: linear-gradient(90deg, var(--ksvp-primary-strong), var(--ksvp-primary), var(--ksvp-blue));
    box-shadow: 0 0 18px rgba(245, 197, 66, 0.32);
}

/* ================================
   Timeline Markers / Fluid Player extras
================================ */
.fluid_timeline_preview,
.ks-video-player .fluid_timeline_preview {
    font-size: 12px;
    font-weight: 700;
    padding: 6px 9px;
    border-radius: 8px;
    background: rgba(3, 7, 16, 0.92);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
    text-align: center;
}

.fluid_marker,
.ks-video-player .fluid_marker {
    width: 4px;
    height: 100%;
    background-color: var(--ksvp-danger);
}

.fluid_marker[data-type='Goal'] { background-color: #ff4d5e; }
.fluid_marker[data-type='Key Pass'] { background-color: #1f7aff; }
.fluid_marker[data-type='Card'] { background-color: #f5c542; }
.fluid_marker[data-type='Penalty'] { background-color: #9b5cff; }

.fluid_controls_progress,
.ks-video-player .fluid_controls_progress {
    position: relative !important;
    overflow: visible !important;
    z-index: 9999;
}

.custom-marker {
    position: absolute;
    top: 0;
    width: 6px;
    height: 100%;
    z-index: 10;
    cursor: pointer;
}

.custom-marker-tooltip {
    display: none;
    position: absolute;
    bottom: 120%;
    left: 50%;
    transform: translateX(-50%);
    margin-bottom: 7px;
    padding: 5px 9px;
    border-radius: 8px;
    background: rgba(3, 7, 16, 0.94);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    z-index: 9999;
    pointer-events: none;
}

.custom-marker:hover .custom-marker-tooltip {
    display: block;
}

/* ================================
   Responsive
================================ */
@media (max-width: 768px) {
    .ks-video-state {
        min-height: 300px;
        padding: 18px;
    }

    .ks-video-state__panel {
        padding: 22px;
    }

    .ks-video-loading__screen {
        aspect-ratio: auto;
        min-height: 320px;
    }

    .c-video .controls,
    .ks-video-player .controls {
        left: 8px;
        right: 8px;
        bottom: 8px;
        transform: translateY(0);
    }

    .c-video .buttons,
    .ks-video-player .buttons {
        padding: 10px;
        gap: 6px;
    }
}

@keyframes ksvpSpin {
    to { transform: rotate(360deg); }
}

@keyframes ksvpPulse {
    0% { box-shadow: 0 0 0 0 rgba(245, 197, 66, 0.70); }
    70% { box-shadow: 0 0 0 9px rgba(245, 197, 66, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 197, 66, 0); }
}

@keyframes ksvpScan {
    0% { transform: translateX(0); opacity: 0; }
    18% { opacity: 1; }
    100% { transform: translateX(390%); opacity: 0; }
}

@keyframes ksvpBar {
    0% { transform: translateX(-110%); }
    55%, 100% { transform: translateX(110%); }
}
