
/*
 MAGIC 1XTRA — FLOATING VIDEO RESPONSIVE V2

 One existing video instance.
 No changes to sources, player state, routing or navigation.
 Applies only when the existing player is floating.
*/

/* Desktop, tablets and mobile: compact player host */
#playerHost:has(> .mx-floating-video:not(.expanded)) {
    position: fixed !important;
    inset: auto 14px var(--mx-pip-nav-offset, 96px) auto !important;

    width: min(380px, calc(100vw - 28px)) !important;
    max-width: calc(100vw - 28px) !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;
    background: transparent !important;

    overflow: visible !important;
    z-index: 3100 !important;
    pointer-events: none !important;
}

/* Prevent the child from retaining full-screen dimensions */
#playerHost > .mx-floating-video:not(.expanded) {
    position: relative !important;
    inset: auto !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    transform: none !important;

    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    background: #101923 !important;
    border: 1px solid rgba(255,255,255,.16) !important;
    border-radius: 22px !important;
    overflow: hidden !important;

    box-shadow: 0 16px 42px rgba(0,0,0,.55) !important;
    pointer-events: auto !important;
    isolation: isolate !important;
}

/* Remove expanded player shells and unwanted extra panels */
#playerHost > .mx-floating-video:not(.expanded)
.flutter-full-player,
#playerHost > .mx-floating-video:not(.expanded)
.xtra-dedicated-player,
#playerHost > .mx-floating-video:not(.expanded)
.xtra-djmix-video-player,
#playerHost > .mx-floating-video:not(.expanded)
.xtra-djmix-video-stage {
    position: relative !important;
    inset: auto !important;

    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    margin: 0 !important;
    padding: 0 !important;

    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* The video is always a compact 16:9 rectangle */
#playerHost > .mx-floating-video:not(.expanded)
.xtra-dedicated-stage,
#playerHost > .mx-floating-video:not(.expanded)
.player-video-wrap {
    position: relative !important;
    inset: auto !important;

    display: block !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    aspect-ratio: 16 / 9 !important;

    margin: 0 !important;
    padding: 0 !important;
    overflow: hidden !important;

    background: #090d13 !important;
    border-radius: 0 !important;
}

/* Use the existing media element, no video recreation */
#playerHost > .mx-floating-video:not(.expanded)
video,
#playerHost > .mx-floating-video:not(.expanded)
iframe {
    position: relative !important;
    inset: auto !important;

    display: block !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    aspect-ratio: 16 / 9 !important;

    margin: 0 !important;
    padding: 0 !important;

    border: 0 !important;
    border-radius: 0 !important;
    object-fit: contain !important;
    background: #090d13 !important;
}

/* No additional audio-style player bars over the video */
#playerHost > .mx-floating-video:not(.expanded)
.flutter-mini-player,
#playerHost > .mx-floating-video:not(.expanded)
.full-player-head,
#playerHost > .mx-floating-video:not(.expanded)
.global-player-actions,
#playerHost > .mx-floating-video:not(.expanded)
.xtra-djmix-up-next,
#playerHost > .mx-floating-video:not(.expanded)
.queue-label,
#playerHost > .mx-floating-video:not(.expanded)
.mx-tv-player-channel {
    display: none !important;
}

/* Reposition the existing channel title within the video card */
#playerHost > .mx-floating-video:not(.expanded)
.dedicated-player-nav {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    width: 100% !important;
    height: 100% !important;

    padding: 0 !important;
    margin: 0 !important;

    background: transparent !important;
    border: 0 !important;
    z-index: 20 !important;
    pointer-events: none !important;
}

#playerHost > .mx-floating-video:not(.expanded)
.dedicated-player-title {
    position: absolute !important;
    left: 14px !important;
    bottom: 10px !important;
    top: auto !important;
    right: 105px !important;

    width: auto !important;
    margin: 0 !important;
    padding: 0 !important;

    color: #fff !important;
    text-align: left !important;
    text-shadow: 0 2px 8px #000 !important;
    pointer-events: none !important;
}

#playerHost > .mx-floating-video:not(.expanded)
.dedicated-player-title b {
    font-size: 15px !important;
    line-height: 1.3 !important;
}

/* Use floating Expand / Close, not duplicate header buttons */
#playerHost > .mx-floating-video:not(.expanded)
.dedicated-player-back,
#playerHost > .mx-floating-video:not(.expanded)
#mxDedicatedShare,
#playerHost > .mx-floating-video:not(.expanded)
#mxDedicatedMore {
    display: none !important;
}

/* Existing JavaScript controls remain interactive */
#playerHost > .mx-floating-video:not(.expanded)
.mx-pip-controls {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    bottom: auto !important;
    left: auto !important;

    display: flex !important;
    gap: 8px !important;
    z-index: 40 !important;
    pointer-events: auto !important;
}

#playerHost > .mx-floating-video:not(.expanded)
.mx-pip-controls button {
    display: grid !important;
    place-items: center !important;

    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;

    padding: 0 !important;
    margin: 0 !important;

    color: #fff !important;
    background: rgba(10,17,28,.82) !important;
    border: 1px solid rgba(255,255,255,.25) !important;
    border-radius: 50% !important;
    font-size: 21px !important;
    cursor: pointer !important;
}

/* App-style LIVE TV label */
#playerHost > .mx-floating-video.mx-tv-player-v3:not(.expanded)::before {
    content: "LIVE TV";
    position: absolute;
    top: 12px;
    left: 12px;
    z-index: 25;
    padding: 7px 11px;

    color: #fff;
    background: #ff0066;
    border-radius: 999px;
    font: 700 11px/1.2 system-ui, sans-serif;
    pointer-events: none;
}

/* Mobile: centred and above the bottom navigation */
@media (max-width: 767px) {
    #playerHost:has(> .mx-floating-video:not(.expanded)) {
        left: 50% !important;
        right: auto !important;
        transform: translateX(-50%) !important;

        width: min(430px, calc(100vw - 24px)) !important;
        bottom: var(--mx-pip-nav-offset, 96px) !important;
    }

    #playerHost > .mx-floating-video:not(.expanded) {
        width: 100% !important;
        transform: none !important;
    }
}

/* Short landscape browsers: reduce floating video size */
@media (max-height: 550px) and (min-width: 768px) {
    #playerHost:has(> .mx-floating-video:not(.expanded)) {
        width: min(300px, calc(100vw - 28px)) !important;
    }
}


/* MX_FLOATING_ABOVE_NAV_V3_START */

/* Only the minimized floating video, never the full player. */
#playerHost:has(> .mx-floating-video:not(.expanded)) {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    top: auto !important;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px)) !important;
    transform: translateX(-50%) !important;

    box-sizing: border-box !important;
    width: min(430px, calc(100vw - 24px)) !important;
    max-width: 430px !important;

    margin: 0 !important;
    z-index: 3400 !important;
}

/* Keep the existing minimized player inside the host. */
#playerHost > .mx-floating-video:not(.expanded) {
    position: relative !important;
    inset: auto !important;
    box-sizing: border-box !important;

    width: 100% !important;
    max-width: 100% !important;

    margin: 0 !important;
    transform: none !important;
}

/* Keep the navigation above the floating player's stacking layer. */
body:has(#playerHost > .mx-floating-video:not(.expanded))
#bottomNav {
    z-index: 3500 !important;
}

/* MX_FLOATING_ABOVE_NAV_V3_END */
