/* ==========================================================================
   css/media_dock.css — YouTube mini-player (js/yt_player.js) and
   private-message chat heads (js/pms.js dock)
   ========================================================================== */

/* ── YouTube player ─────────────────────────────────────── */
.cwsyt-backdrop {
    position: fixed;
    inset: 0;
    z-index: 9790;
    background: rgba(10,10,10, 0.88);
    backdrop-filter: blur(3px);
    display: none;
}
.cwsyt-backdrop.on { display: block; animation: cwsytFade .15s ease; }
@keyframes cwsytFade { from { opacity: 0; } to { opacity: 1; } }

.cwsyt {
    position: fixed;
    display: none;
    flex-direction: column;
    background: #0c0c0c;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6);
}
.cwsyt.on { display: flex; }

.cwsyt-head {
    display: flex;
    align-items: center;
    gap: 2px;
    height: 36px;
    padding: 0 4px 0 6px;
    background: rgba(255, 255, 255, 0.04);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    flex-shrink: 0;
    user-select: none;
    touch-action: none;
}
.cwsyt-logo { color: #ff0033; font-size: 15px; margin: 0 4px 0 2px; flex-shrink: 0; }
.cwsyt-title {
    flex: 1;
    min-width: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: #e5e5e5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cwsyt-btn {
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 8px;
    background: none;
    color: #a3a3a3;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    text-decoration: none;
}
.cwsyt-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.08); }
.cwsyt-close:hover { color: #f87171; }
.cwsyt-video { position: relative; aspect-ratio: 16 / 9; background: #000; }
.cwsyt-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

/* full — centered, big */
.cwsyt.full {
    z-index: 9800;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(94vw, 960px);
}
.cwsyt.full .cwsyt-play,
.cwsyt.full .cwsyt-max,
.cwsyt.full .cwsyt-bar-btn { display: none; }
.cwsyt.full .cwsyt-head { height: 42px; }
body.cwsyt-full { overflow: hidden; }

/* mini — floating video, draggable by its header */
.cwsyt.mini,
.cwsyt.bar {
    z-index: 1300;          /* over the room + desktop PM box; under the phone full-screen PM box (1310) */
    transform: none;
    width: 320px;
}
.cwsyt.mini .cwsyt-min,
.cwsyt.bar .cwsyt-min { display: none; }
.cwsyt.mini .cwsyt-head,
.cwsyt.bar .cwsyt-head { cursor: grab; }
.cwsyt.mini .cwsyt-title,
.cwsyt.bar .cwsyt-title { cursor: pointer; }
.cwsyt.dragging { opacity: .92; transition: none; }
.cwsyt.dragging .cwsyt-head { cursor: grabbing; }

/* bar — audio only. The iframe stays rendered (clipped, not display:none)
   so playback keeps going. */
.cwsyt.bar { width: 280px; }
.cwsyt.bar .cwsyt-video {
    height: 0;
    aspect-ratio: auto;
    overflow: hidden;
}
.cwsyt.bar .cwsyt-video iframe { width: 200px; height: 113px; }
.cwsyt.bar .cwsyt-head { border-bottom: none; }
.cwsyt.bar .cwsyt-play { color: #ff4d6d; }

@media (max-width: 768px) {
    .cwsyt.full { width: 100vw; border-radius: 0; border-left: none; border-right: none; }
    .cwsyt.mini { width: min(62vw, 260px); }
    .cwsyt.bar  { width: min(78vw, 280px); }
    .cwsyt.mini .cwsyt-ext,
    .cwsyt.bar  .cwsyt-ext { display: none; }
    .cwsyt.mini .cwsyt-head { height: 34px; }
    .cwsyt.mini .cwsyt-btn { width: 28px; height: 28px; }
}

/* ── PM chat heads ──────────────────────────────────────── */
.pm-dock {
    position: fixed;
    right: 14px;
    bottom: 84px;           /* clear of the composer */
    z-index: 1150;          /* over the room, under the PM box (1160) and float menus */
    display: flex;
    flex-direction: column-reverse;
    gap: 10px;
    pointer-events: none;
}
.pm-dock[hidden] { display: none; }
.pm-dock-chip {
    pointer-events: auto;
    position: relative;
    width: 50px;
    height: 50px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    background: #141414;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
    transition: transform .12s ease, border-color .12s ease;
}
.pm-dock-chip.is-new { animation: pmDockIn .18s ease-out; }
.pm-dock-chip.has-unread .pm-dock-badge { animation: pmDockPing .3s ease-out; }
@keyframes pmDockPing { from { transform: scale(1.5); } to { transform: none; } }
@keyframes pmDockIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
.pm-dock-chip:hover { transform: scale(1.06); border-color: rgba(212, 178, 106, 0.6); }
.pm-dock-chip.has-unread { border-color: #b8964f; }
.pm-dock-chip img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.pm-dock-dot {
    position: absolute;
    right: 1px;
    bottom: 1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #525252;
    border: 2px solid #0c0c0c;
}
.pm-dock-dot.online { background: #22c55e; }
.pm-dock-badge {
    position: absolute;
    top: -4px;
    left: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 999px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    border: 2px solid #0c0c0c;
    box-sizing: border-box;
}
.pm-dock-name {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(16,16,16, 0.96);
    color: #e5e5e5;
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 8px;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.08);
    opacity: 0;
    pointer-events: none;
    transition: opacity .12s;
}
.pm-dock-x {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #262626;
    color: #d4d4d4;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.15);
    opacity: 0;
    transition: opacity .12s;
}
.pm-dock-x:hover { background: #dc2626; color: #fff; }
@media (hover: hover) {
    .pm-dock-chip:hover .pm-dock-name,
    .pm-dock-chip:hover .pm-dock-x { opacity: 1; }
}
/* Touch: no hover — keep the dismiss × visible (small) on phones. */
@media (hover: none) {
    .pm-dock-x { opacity: .85; width: 18px; height: 18px; }
}
@media (max-width: 768px) {
    .pm-dock { right: 10px; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); gap: 8px; }
    .pm-dock-chip { width: 46px; height: 46px; }
    /* social.css hid the old collapse button on phones (collapsing a full-screen
       box was pointless). Minimize now docks the chat — bring it back. */
    #pmBox #pmCollapseBtn { display: inline-block; font-size: 18px; padding: 6px 9px; }
    /* The phone PM box is full screen — heads would just sit on top of it. */
    body.pmx-box-open .pm-dock { display: none; }
}
