/* ===== WATCH PARTY ROOM ===== */

/* Hide entire site header on room page — room has its own top bar */
.room-page .header {
    display: none !important;
}

.room-main {
    padding-top: 0;
}

.room-layout {
    display: flex;
    gap: 0;
    min-height: 100vh;
    align-items: stretch;
}

/* ---- Player column ---- */
.room-player-col {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    background: #000;
}

/* ---- Top bar (replaces site header on room page) ---- */
.room-topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: nowrap;
    padding: 0 16px;
    height: 52px;
    min-height: 52px;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: relative;
    z-index: 10;
}

.room-topbar-logo {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
    text-decoration: none;
    flex-shrink: 0;
    padding-right: 8px;
    border-right: 1px solid var(--border);
}
.room-topbar-logo span { color: var(--text); }

.room-film-link {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.room-film-link:hover { color: var(--accent); }

.room-film-year {
    font-weight: 400;
    color: var(--text2);
    font-size: 13px;
    margin-left: 4px;
}

.room-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.room-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.4;
}
.room-badge-host   { background: rgba(255, 200, 0, .15); color: #ffc800; border: 1px solid rgba(255, 200, 0, .3); }
.room-badge-viewer { background: rgba(100, 200, 100, .12); color: #6bca6b; border: 1px solid rgba(100, 200, 100, .25); }

.room-members {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text2);
}

.room-leave-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: rgba(255,60,60,.1);
    border: 1px solid rgba(255,60,60,.25);
    border-radius: 6px;
    color: #f87171;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.room-leave-btn:hover {
    background: rgba(255,60,60,.25);
    color: #fca5a5;
}

/* Player fills remaining space */
.room-player {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    flex-shrink: 0;
}

/* Join hint text under the play button (viewer) */
.room-join-hint {
    position: relative;
    z-index: 2;
    font-size: 13px;
    color: rgba(255,255,255,.55);
    margin: 0;
    pointer-events: none;
}

/* Viewer: hide seek input, show read-only bar */
.room-is-viewer .axo-seek {
    display: none;
}
.axo-seek-readonly {
    position: absolute;
    inset: 0;
    cursor: default;
    pointer-events: none;
}

/* Waiting overlay for viewers */
.room-waiting-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: var(--text2);
}
.room-waiting-overlay i {
    font-size: 48px;
    color: rgba(255,255,255,.3);
}
.room-waiting-overlay p {
    font-size: 14px;
    margin: 0;
}

/* Share link bar */
.room-share {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
}
.room-share-label {
    font-size: 12px;
    color: var(--text2);
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 5px;
    flex-shrink: 0;
}
.room-share-input {
    flex: 1;
    min-width: 0;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 13px;
    color: var(--text1);
    outline: none;
    cursor: text;
}
.room-share-copy {
    flex-shrink: 0;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    color: var(--text1);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    transition: background .15s, color .15s;
}
.room-share-copy:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---- Chat column ---- */
.room-chat-col {
    width: 320px;
    min-width: 280px;
    max-width: 360px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border);
    background: var(--bg1);
}

.room-chat {
    display: flex;
    flex-direction: column;
    height: 100%;
    /* Sticky positioning within layout */
    position: sticky;
    top: 0;
    max-height: 100vh;
}

.room-chat-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text1);
    border-bottom: 1px solid var(--border);
    background: var(--bg2);
    flex-shrink: 0;
}

.room-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.room-chat-messages::-webkit-scrollbar { width: 4px; }
.room-chat-messages::-webkit-scrollbar-track { background: transparent; }
.room-chat-messages::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* Chat message bubbles */
.chat-msg {
    display: flex;
    flex-direction: column;
    gap: 2px;
    animation: chat-fade-in .2s ease;
}

@keyframes chat-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-bubble {
    background: var(--bg3);
    border-radius: 8px 8px 8px 2px;
    padding: 7px 10px;
    font-size: 13px;
    line-height: 1.4;
    word-break: break-word;
    max-width: 100%;
    color: var(--text1);
}

.chat-msg.mine .chat-msg-bubble {
    background: rgba(229, 9, 20, .18);
    border-radius: 8px 8px 2px 8px;
    align-self: flex-end;
}

.chat-msg-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    color: var(--text3);
}

.chat-msg.mine .chat-msg-meta {
    justify-content: flex-end;
}

.chat-msg-user {
    font-weight: 600;
    color: var(--text2);
}

.chat-msg-time {
    opacity: .7;
}

/* System messages (join/leave/play/pause/seek) */
.chat-system {
    text-align: center;
    font-size: 11px;
    color: var(--text3);
    padding: 2px 0;
    animation: chat-fade-in .2s ease;
}

/* Input area */
.room-chat-input-wrap {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg2);
    flex-shrink: 0;
}

.room-chat-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text1);
    outline: none;
    transition: border-color .15s;
}
.room-chat-input:focus { border-color: var(--accent); }
.room-chat-input::placeholder { color: var(--text3); }

.room-chat-send {
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    transition: background .15s, transform .1s;
}
.room-chat-send:hover  { background: #c0000e; }
.room-chat-send:active { transform: scale(.95); }

/* ---- Responsive ---- */
@media (max-width: 820px) {
    .room-layout {
        flex-direction: column;
    }
    .room-chat-col {
        width: 100%;
        max-width: 100%;
        border-left: none;
        border-top: 1px solid var(--border);
    }
    .room-chat {
        position: static;
        max-height: 400px;
    }
}

/* ---- Topbar title ---- */
.room-topbar-title {
    font-size: 14px;
    color: var(--text2);
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---- Waiting overlay (no video loaded) ---- */
.room-waiting {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--text2);
    background: #000;
    z-index: 5;
    text-align: center;
    padding: 24px;
    pointer-events: none;
}
.room-waiting i {
    font-size: 52px;
    color: rgba(255,255,255,.2);
}
.room-waiting p {
    margin: 0;
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,.7);
}
.room-waiting-sub {
    font-size: 13px !important;
    font-weight: 400 !important;
    color: rgba(255,255,255,.4) !important;
}

/* ---- URL panel (host only, below player) ---- */
.room-url-panel {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg2);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.room-url-icon {
    font-size: 18px;
    color: var(--text3);
    flex-shrink: 0;
}

.room-url-input {
    flex: 1;
    min-width: 0;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    color: var(--text1);
    outline: none;
    transition: border-color .15s;
}
.room-url-input:focus { border-color: var(--accent); }
.room-url-input::placeholder { color: var(--text3); font-size: 12px; }

.room-url-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background .15s, opacity .15s;
}
.room-url-btn:hover:not(:disabled) { background: #c0000e; }
.room-url-btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---- Unmute banner (viewer muted autoplay) ---- */
.room-unmute-banner {
    position: absolute;
    bottom: 60px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(0,0,0,.8);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.2);
    border-radius: 20px;
    color: rgba(255,255,255,.9);
    font-size: 13px;
    z-index: 20;
    white-space: nowrap;
    animation: catchup-in .2s ease;
}
.room-unmute-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: #fff;
    color: #000;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.room-unmute-btn:hover { background: #e5e5e5; }

/* ---- Catch-up notice (viewer drift) ---- */
.room-catchup {
    position: absolute;
    top: 14px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,200,0,.4);
    border-radius: 20px;
    color: #ffc800;
    font-size: 13px;
    font-weight: 600;
    z-index: 20;
    white-space: nowrap;
    animation: catchup-in .2s ease;
}
@keyframes catchup-in {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.room-catchup-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: #ffc800;
    color: #000;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s, transform .1s;
}
.room-catchup-btn:hover  { background: #ffdd44; }
.room-catchup-btn:active { transform: scale(.95); }

/* ---- Buffering spinner ---- */
.room-buffering {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.35);
    z-index: 15;
    pointer-events: none;
}
.room-buffering-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255,255,255,.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- "Create room" button (profile.php) ---- */
.btn-create-room {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: rgba(229, 9, 20, .15);
    border: 1px solid rgba(229, 9, 20, .35);
    border-radius: 8px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
    white-space: nowrap;
}
.btn-create-room:hover {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* ---- Room creation modal (profile.php) ---- */
.room-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.75);
    z-index: 900;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: modal-in .18s ease;
}

@keyframes modal-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.room-modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 480px;
    padding: 28px;
    position: relative;
    animation: modal-slide .2s ease;
}

@keyframes modal-slide {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.room-modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: none;
    color: var(--text2);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color .15s;
}
.room-modal-close:hover { color: var(--text1); }

.room-modal h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0 0 20px;
}

.room-modal-search {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
}

.room-modal-search-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 14px;
    color: var(--text1);
    outline: none;
    transition: border-color .15s;
}
.room-modal-search-input:focus { border-color: var(--accent); }

.room-modal-film-list {
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 16px;
    scrollbar-width: thin;
}

.room-modal-film-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    transition: background .12s;
}
.room-modal-film-item:last-child { border-bottom: none; }
.room-modal-film-item:hover { background: var(--bg3); }
.room-modal-film-item.selected { background: rgba(229,9,20,.12); }

.room-modal-film-poster {
    width: 32px;
    height: 48px;
    object-fit: cover;
    border-radius: 4px;
    background: var(--bg3);
    flex-shrink: 0;
}

.room-modal-film-info { flex: 1; min-width: 0; }
.room-modal-film-title {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.room-modal-film-year {
    font-size: 11px;
    color: var(--text3);
}

.room-modal-empty {
    padding: 20px;
    text-align: center;
    color: var(--text3);
    font-size: 13px;
}

.room-modal-actions {
    display: flex;
    gap: 10px;
}

.room-modal-btn-create {
    flex: 1;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
.room-modal-btn-create:hover:not(:disabled) { background: #c0000e; }
.room-modal-btn-create:disabled { opacity: .5; cursor: not-allowed; }

/* Result: share link */
.room-modal-result {
    display: none;
    flex-direction: column;
    gap: 12px;
}
.room-modal-result.visible { display: flex; }

.room-modal-result-label {
    font-size: 13px;
    color: var(--text2);
    text-align: center;
}
.room-modal-result-link {
    display: flex;
    gap: 8px;
}
.room-modal-result-input {
    flex: 1;
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 13px;
    color: var(--text1);
    outline: none;
}
.room-modal-result-copy {
    flex-shrink: 0;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 9px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s;
}
.room-modal-result-copy:hover { background: #c0000e; }

.room-modal-result-go {
    background: var(--bg3);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px;
    font-size: 13px;
    color: var(--text1);
    text-align: center;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s;
    display: block;
}
.room-modal-result-go:hover { background: var(--bg2); color: var(--accent); }
