/**
 * VMPlayer Pop-Out Player Styles
 *
 * Portrait layout with window chrome bar. Compact bar variant for
 * the minimize state. Kebab menu popover shared between main and
 * pop-out players.
 *
 * Loaded alongside vmplayer-frontend.css, which provides the base
 * player tokens and shared component styles. This file layers the
 * popout-specific structure on top.
 *
 * @package VMPlayer
 */

/* ==================================================================
 * Body baseline (popout runs on its own standalone page)
 * =============================================================== */

html,
body.vmplayer-popout-body {
    margin: 0;
    padding: 0;
    height: 100%;
    background: #0a0a0f;
    overflow-x: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ==================================================================
 * Popout container
 * =============================================================== */

.vmplayer-popout {
    width: 100%;
    min-height: 100%;
    max-width: none;
    margin: 0;
    border: none;
    border-radius: 0;
    background: var(--vmp-bg);
    display: flex;
    flex-direction: column;
}

.vmplayer-popout__window {
    display: flex;
    flex-direction: column;
    padding: 18px 22px 20px;
    flex: 1;
    gap: 16px;
}

/* ==================================================================
 * Chrome (window title bar)
 * =============================================================== */

.vmplayer-popout__chrome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.vmplayer-popout__identity {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.vmplayer-popout__station-icon {
    width: 40px;
    height: 40px;
    color: var(--vmp-primary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(168, 85, 247, 0.12);
    border-radius: 10px;
    border: 1px solid rgba(168, 85, 247, 0.25);
    overflow: hidden;
}

.vmplayer-popout__station-icon img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vmplayer-popout__identity-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.vmplayer-popout__station-name {
    color: var(--vmp-text);
    font-size: 17px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

.vmplayer-popout__label {
    color: var(--vmp-text-muted);
    font-size: 11px;
    letter-spacing: 1.4px;
    font-weight: 600;
    margin-top: 2px;
}

.vmplayer-popout__station-counter {
    font-size: 10px;
    padding: 2px 8px;
    margin-top: 4px;
    letter-spacing: 0.3px;
}

.vmplayer-popout__controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.vmplayer-popout__ctrl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--vmp-text-dim);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.vmplayer-popout__ctrl:hover {
    background: var(--vmp-surface-hover);
    color: var(--vmp-text);
}

.vmplayer-popout__ctrl:focus-visible {
    outline: 2px solid var(--vmp-primary);
    outline-offset: 2px;
}

/* ==================================================================
 * Status row (ON AIR + clock)
 * =============================================================== */

.vmplayer-popout__status {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.vmplayer-popout__status .vmplayer__time {
    font-size: 20px;
}

.vmplayer-popout__status .vmplayer__date {
    font-size: 12px;
    margin-left: 6px;
}

/* ==================================================================
 * Artwork
 * =============================================================== */

.vmplayer-popout__artwork-wrap {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    overflow: hidden;
    background: var(--vmp-surface);
    border: 1px solid var(--vmp-border);
}

.vmplayer-popout__artwork {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.vmplayer-popout__artwork img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ==================================================================
 * Body: track info + visualizer side by side
 * =============================================================== */

.vmplayer-popout__body {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: end;
}

.vmplayer-popout__info {
    min-width: 0;
}

.vmplayer-popout__info .vmplayer__now-playing-label {
    font-size: 12px;
    margin-bottom: 6px;
}

.vmplayer-popout__info .vmplayer__track-title {
    font-size: 28px;
    line-height: 1.15;
    margin: 0 0 4px 0;
    word-break: break-word;
}

.vmplayer-popout__info .vmplayer__artist {
    font-size: 18px;
    margin: 0;
}

.vmplayer-popout__visualizer {
    width: 140px;
    padding-bottom: 4px;
}

.vmplayer-popout__visualizer .vmplayer__visualizer {
    height: 70px;
    gap: 2px;
}

.vmplayer-popout__visualizer .vmplayer__visualizer-bar {
    width: 4px;
}

/* ==================================================================
 * Popout adjustments to shared components
 * =============================================================== */

.vmplayer-popout .vmplayer__stream-info {
    font-size: 13px;
    margin: 0;
    padding: 2px 0;
}

.vmplayer-popout .vmplayer__description {
    font-size: 13px;
    margin: 0;
    padding: 4px 0;
}

.vmplayer-popout .vmplayer__streaming-via {
    margin-top: 4px;
}

.vmplayer-popout .vmplayer__format-badges {
    gap: 8px;
    flex-wrap: wrap;
}

.vmplayer-popout .vmplayer__format-badge {
    padding: 7px 12px;
    font-size: 12px;
}

/* Transport in popout: single row, compact spacing */

.vmplayer-popout__transport {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 0;
    gap: 12px;
    margin-top: 4px;
}

.vmplayer-popout__transport .vmplayer__volume {
    gap: 8px;
    flex-shrink: 1;
    min-width: 0;
}

.vmplayer-popout__transport .vmplayer__volume-slider {
    max-width: 90px;
    min-width: 60px;
}

.vmplayer-popout__transport .vmplayer__playback {
    gap: 10px;
    flex-shrink: 0;
}

.vmplayer-popout__transport .vmplayer__play-toggle {
    width: 56px;
    height: 56px;
}

.vmplayer-popout__transport .vmplayer__play-toggle svg {
    width: 24px;
    height: 24px;
}

.vmplayer-popout__transport .vmplayer__prev,
.vmplayer-popout__transport .vmplayer__next {
    width: 40px;
    height: 40px;
    padding: 8px;
}

/* Footer with social + kebab, no supports here (moved below) */

.vmplayer-popout__footer {
    padding-top: 12px;
    border-top: 1px solid var(--vmp-border);
}

.vmplayer-popout__footer .vmplayer__follow {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    justify-content: flex-start;
}

.vmplayer-popout__footer .vmplayer__follow-label {
    align-self: flex-start;
}

.vmplayer-popout__footer .vmplayer__social {
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.vmplayer-popout__footer .vmplayer__kebab {
    margin-left: auto;
}

.vmplayer-popout__supports {
    padding: 14px 22px 18px;
    color: var(--vmp-text-muted);
    font-size: 12px;
    text-align: center;
    background: var(--vmp-bg);
    border-top: 1px solid var(--vmp-border);
}

.vmplayer-popout__supports span {
    margin: 0 3px;
}

.vmplayer-popout__supports .vmplayer__sep {
    opacity: 0.5;
    margin: 0 4px;
}

/* ==================================================================
 * Compact bar mode
 * =============================================================== */

.vmplayer-popout--compact .vmplayer-popout__window,
.vmplayer-popout--compact .vmplayer-popout__supports {
    display: none;
}

body.vmplayer-popout--compact {
    background: var(--vmp-bg);
}

.vmplayer-popout__compact {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 14px;
    background: var(--vmp-bg);
    border: 1px solid var(--vmp-border);
    height: 60px;
    box-sizing: border-box;
    color: var(--vmp-text);
}

.vmplayer-popout__compact[hidden] {
    display: none;
}

.vmplayer-popout__compact-marquee {
    flex: 1;
    overflow: hidden;
    white-space: nowrap;
    min-width: 0;
}

.vmplayer-popout__compact-title {
    display: inline-block;
    padding-left: 100%;
    animation: vmp-marquee 18s linear infinite;
    font-size: 14px;
    font-weight: 600;
    color: var(--vmp-text);
}

@keyframes vmp-marquee {
    0%   { transform: translateX(0); }
    100% { transform: translateX(-100%); }
}

.vmplayer-popout__compact-play {
    width: 40px;
    height: 40px;
    padding: 0;
    background: linear-gradient(135deg, var(--vmp-primary), var(--vmp-secondary));
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
    flex-shrink: 0;
}

.vmplayer-popout__compact-play:hover {
    background: linear-gradient(135deg, var(--vmp-primary), var(--vmp-secondary));
    border-color: rgba(255, 255, 255, 0.35);
}

.vmplayer-popout__compact-play .vmplayer__icon-pause,
.vmplayer-popout__compact-play[data-state="playing"] .vmplayer__icon-play {
    display: none;
}

.vmplayer-popout__compact-play[data-state="playing"] .vmplayer__icon-pause {
    display: block;
}

.vmplayer-popout__compact-volume {
    max-width: 80px;
    flex-shrink: 0;
}

.vmplayer-popout__compact-restore {
    width: 32px;
    height: 32px;
    padding: 0;
    background: transparent;
    border: 1px solid var(--vmp-border);
    color: var(--vmp-text-dim);
    flex-shrink: 0;
}

.vmplayer-popout__compact-restore:hover {
    background: var(--vmp-surface-hover);
    color: var(--vmp-text);
    border-color: var(--vmp-primary);
}

/* ==================================================================
 * Kebab menu (shared between main and popout)
 * =============================================================== */

.vmplayer-kebab-menu {
    position: absolute;
    z-index: 999999;
    min-width: 260px;

    /* Kebab menu lives on document.body, OUTSIDE the .vmplayer
       container, so the CSS variables scoped to .vmplayer never
       cascade in. Define local copies here so all the var() calls
       below resolve correctly. Without this, a theme with a black
       body color would win and paint the menu text black on the
       dark navy background, making everything unreadable. */
    --vmp-text: #f8fafc !important;
    --vmp-text-dim: #94a3b8 !important;
    --vmp-primary: #a855f7 !important;
    --vmp-border: #1f1f2e !important;
    --vmp-surface-hover: #16162a !important;

    background: #16162a !important;
    border: 1px solid #1f1f2e !important;
    border-radius: 12px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6) !important;
    color: #f8fafc !important;
    padding: 8px 0 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    font-size: 14px !important;
}

.vmplayer-kebab-menu[hidden] {
    display: none;
}

.vmplayer-kebab-menu__section {
    padding: 6px 0;
}

.vmplayer-kebab-menu__section + .vmplayer-kebab-menu__section {
    border-top: 1px solid var(--vmp-border);
}

.vmplayer-kebab-menu__heading {
    padding: 6px 16px 4px !important;
    color: #a855f7 !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    letter-spacing: 1.2px !important;
    text-transform: uppercase !important;
}

.vmplayer-kebab-menu__item {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    width: 100% !important;
    padding: 10px 16px !important;
    background: transparent !important;
    border: none !important;
    color: #f8fafc !important;
    font-size: 14px !important;
    cursor: pointer !important;
    text-align: left !important;
    transition: background 0.12s !important;
    font-family: inherit !important;
}

.vmplayer-kebab-menu__item:hover {
    background: #16162a !important;
    color: #f8fafc !important;
}

.vmplayer-kebab-menu__item:focus-visible {
    outline: 2px solid #a855f7 !important;
    outline-offset: -2px !important;
}

.vmplayer-kebab-menu__item-icon {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: #94a3b8 !important;
    width: 20px !important;
    height: 20px !important;
    flex-shrink: 0 !important;
}

.vmplayer-kebab-menu__item-label {
    flex: 1 !important;
    color: #f8fafc !important;
}

.vmplayer-kebab-menu__item-check {
    color: var(--vmp-primary);
    margin-left: auto;
    display: none;
}

.vmplayer-kebab-menu__item.is-active .vmplayer-kebab-menu__item-check {
    display: inline-flex;
}

.vmplayer-kebab-menu__about {
    padding: 4px 16px 10px !important;
    color: #94a3b8 !important;
    font-size: 13px !important;
    line-height: 1.5 !important;
}

.vmplayer-kebab-menu__about-station {
    color: #f8fafc !important;
    font-weight: 600 !important;
}

.vmplayer-kebab-menu__about-tagline {
    margin-top: 2px !important;
    color: #94a3b8 !important;
}

.vmplayer-kebab-menu__about-powered {
    margin-top: 8px !important;
    font-size: 11px !important;
    color: #64748b !important;
}

.vmplayer-kebab-menu__toggle {
    position: relative;
    width: 36px;
    height: 20px;
    margin-left: auto;
    background: var(--vmp-border);
    border-radius: 999px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.vmplayer-kebab-menu__toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--vmp-text);
    border-radius: 50%;
    transition: transform 0.15s;
}

.vmplayer-kebab-menu__item.is-toggled .vmplayer-kebab-menu__toggle {
    background: var(--vmp-primary);
}

.vmplayer-kebab-menu__item.is-toggled .vmplayer-kebab-menu__toggle::after {
    transform: translateX(16px);
    background: #fff;
}

.vmplayer-kebab-menu__toast {
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--vmp-primary);
    color: #fff;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}

.vmplayer-kebab-menu__toast.is-visible {
    opacity: 1;
}

/* Backdrop that closes menu when clicked outside */

.vmplayer-kebab-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999998;
    background: transparent;
}

.vmplayer-kebab-backdrop[hidden] {
    display: none;
}

/* ==================================================================
 * Popout container queries for very narrow widths
 * =============================================================== */

.vmplayer-popout {
    container-type: inline-size;
    container-name: vmplayer-popout;
}

@container vmplayer-popout (max-width: 360px) {
    .vmplayer-popout__window {
        padding: 14px 14px 16px;
        gap: 12px;
    }

    .vmplayer-popout__station-name {
        font-size: 15px;
        max-width: 160px;
    }

    .vmplayer-popout__info .vmplayer__track-title {
        font-size: 22px;
    }

    .vmplayer-popout__info .vmplayer__artist {
        font-size: 16px;
    }

    .vmplayer-popout__visualizer {
        width: 100px;
    }

    .vmplayer-popout__body {
        gap: 8px;
    }
}
