/* ========================================
   מילנר TV — feature: Chromecast
   Tokens come from css/styles.css.
   ======================================== */

/* ----- Casting overlay inside #player-container (above the app's tap
         overlay at z-index 5, below #player-error / #player-loading at 10) ----- */
.fx-cast-overlay {
    position: absolute;
    inset: 0;
    z-index: 6;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    overflow: hidden;
    text-align: center;
    color: var(--text-primary);
    background: radial-gradient(ellipse at 50% 35%, rgba(220, 38, 38, 0.22), transparent 65%), #000;
}

.fx-cast-overlay--hidden { display: none; }

.fx-cast-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: var(--radius-full);
    background: var(--gradient-brand);
    color: #fff;
    box-shadow: 0 4px 16px rgba(220, 38, 38, 0.35);
}

.fx-cast-title {
    max-width: 100%;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.3;
}

.fx-cast-device {
    unicode-bidi: isolate;
}

.fx-cast-channel {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    color: var(--text-secondary);
}

.fx-cast-channel:empty { display: none; }

.fx-cast-status {
    min-height: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.fx-cast-status:empty { display: none; }

.fx-cast-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    direction: ltr;
}

.fx-cast-iconbtn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: var(--radius-full);
}

.fx-cast-seek {
    min-width: 46px;
    padding: 0 12px;
    direction: ltr;
    unicode-bidi: isolate;
    font-variant-numeric: tabular-nums;
}

.fx-cast-stop { margin-top: 2px; }

/* Portrait phones: the 16:9 frame is only ~200px tall */
@media (max-width: 560px) and (orientation: portrait) {
    .fx-cast-overlay { gap: 4px; padding: 8px 12px; }
    .fx-cast-icon { width: 34px; height: 34px; }
    .fx-cast-title { font-size: 14px; }
    .fx-cast-channel { font-size: 12px; }
    .fx-cast-iconbtn { width: 36px; height: 36px; }
    .fx-cast-controls { margin-top: 2px; }
}

/* ----- Floating pill (player view not active). Sits above #fx-snack
         (bottom: safe-bottom + 20px) and the mini player (72px). ----- */
.fx-cast-bar {
    position: fixed;
    bottom: calc(var(--safe-bottom) + 76px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 255;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: min(520px, calc(100vw - 32px));
    padding: 6px 8px 6px 14px;
    background: rgba(26, 10, 14, 0.96);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-full);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-size: 13px;
    transition: opacity 0.25s ease, transform 0.25s var(--ease-out), visibility 0s;
}

body.mini-player-active .fx-cast-bar { bottom: calc(var(--safe-bottom) + 140px); }

.fx-cast-bar--hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateX(-50%) translateY(12px);
    transition: opacity 0.25s ease, transform 0.25s var(--ease-out), visibility 0s 0.25s;
}

.fx-cast-bar-icon {
    display: flex;
    flex-shrink: 0;
    color: var(--primary-light);
}

.fx-cast-bar-text {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 600;
}

.fx-cast-bar-stop { flex-shrink: 0; }

@media (prefers-reduced-motion: reduce) {
    .fx-cast-bar,
    .fx-cast-bar--hidden { transition: none; }
}
