/* ===== Live Room Page - Matching Original Layout ===== */

/* Body background for room page */
body[data-page="room"] {
    background: #f0f1f6;
}

/* Room inner has no side padding (exact 1200px) */
body[data-page="room"] .live-room-box.inner {
    padding: 0;
}

/* ===== Dark Top Section ===== */
.live-room {
    background: #25284c;
    padding-top: 88px;
    padding-bottom: 10px;
}

.live-room-box {
    position: relative;
    padding-top: 10px;
    padding-bottom: 12px;
    display: flex;
    gap: 10px;
}

/* ===== Left: Media Column ===== */
.media {
    flex: 1;
    min-width: 0;
}

/* --- Anchor Info (top-block) --- */
.top-block {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    height: 100px;
    background: #fff;
    border-radius: 6px 6px 0 0;
}

.top-left-block {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-left-block .head-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.top-left-block .text .text-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    max-width: 300px;
}

.top-left-block .text .text-msg {
    font-size: 12px;
    color: #999;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-left-block .text .text-msg .nick-name {
    color: var(--color-primary);
}

.top-left-block .text .text-msg .view-num::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23999"><path d="M12 4.5C7 4.5 2.73 7.61 1 12c1.73 4.39 6 7.5 11 7.5s9.27-3.11 11-7.5c-1.73-4.39-6-7.5-11-7.5zM12 17c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-8c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3z"/></svg>') center/contain no-repeat;
    margin-right: 3px;
    vertical-align: middle;
}

.top-left-block .text .text-msg .mobile-text a {
    color: #999;
    font-size: 11px;
}

.top-right-block {
    display: flex;
    align-items: center;
    gap: 14px;
}

.top-right-block .follow-btn {
    display: inline-block;
    padding: 6px 24px;
    border: 2px solid var(--color-primary);
    border-radius: 20px;
    color: var(--color-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.top-right-block .follow-btn:hover {
    background: var(--color-primary);
    color: #fff;
}

.top-right-block .follow-btn.followed {
    background: #f0f0f0;
    border-color: #ddd;
    color: #999;
}

.top-right-block .code-btn {
    display: flex;
    align-items: center;
}

.top-right-block .code-btn img {
    width: 28px;
    height: 28px;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.top-right-block .code-btn:hover img { opacity: 1; }

.top-right-block .more-box {
    position: relative;
}

.top-right-block .report-btn {
    color: #999;
    font-size: 12px;
    cursor: pointer;
    transition: color 0.2s;
}

.top-right-block .report-btn:hover { color: #666; }

/* --- Video Player (center-block) --- */
.center-block {
    width: 100%;
    position: relative;
}

.video-player {
    width: 100%;
    height: 484px;
    background: #000;
    position: relative;
    overflow: hidden;
}

.video-player video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Big Play Button */
.big-play-btn {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 120px;
    height: 120px;
    cursor: pointer;
    z-index: 15;
    opacity: 0.8;
    transition: opacity 0.3s, transform 0.3s;
}

.big-play-btn:hover {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.08);
}

/* Player Loading */
.player-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 10;
}

.player-loading .loading-spin {
    width: 60px;
    height: 60px;
    animation: spin 1.5s linear infinite;
}

.player-loading .loading-logo {
    position: absolute;
    width: 26px;
    height: 26px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -70%);
}

.player-loading p {
    color: #fff;
    margin-top: 14px;
    font-size: 14px;
}

/* Danmaku Layer */
.danmaku-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: calc(100% - 40px);
    pointer-events: none;
    overflow: hidden;
    z-index: 5;
}

.danmaku-item {
    position: absolute;
    white-space: nowrap;
    color: #fff;
    font-size: 16px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
    animation: danmakuFlow linear;
    will-change: transform;
}

@keyframes danmakuFlow {
    from { transform: translateX(100%); }
    to { transform: translateX(-100%); }
}

/* Player Controls Bar */
.player-ctrl {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85));
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.25s;
}

.video-player:hover .player-ctrl { opacity: 1; }

.ctrl-left,
.ctrl-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ctrl-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 16px;
    opacity: 0.8;
    transition: opacity 0.15s;
    user-select: none;
}

.ctrl-btn:hover { opacity: 1; }

/* Volume Slider */
.volume-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
}

.volume-slider {
    width: 60px;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
}

.volume-slider .volume-fill {
    height: 100%;
    background: var(--color-primary);
    border-radius: 2px;
    width: 70%;
}

.volume-slider .volume-dot {
    position: absolute;
    top: 50%;
    left: 70%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background: var(--color-primary);
    border-radius: 50%;
    cursor: grab;
}

/* Definition Selector */
.def-select { position: relative; }

.def-select .def-current {
    padding: 1px 6px;
    border: 1px solid var(--color-primary);
    border-radius: 2px;
    color: var(--color-primary);
    font-size: 11px;
    cursor: pointer;
}

.def-select .def-options {
    display: none;
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.85);
    border-radius: 4px;
    overflow: hidden;
    min-width: 50px;
}

.def-select:hover .def-options { display: block; }

.def-select .def-options span {
    display: block;
    padding: 5px 10px;
    font-size: 12px;
    color: #fff;
    cursor: pointer;
    white-space: nowrap;
    text-align: center;
}

.def-select .def-options span:hover,
.def-select .def-options span.active { color: var(--color-primary); }

/* Fullscreen mode */
.video-player.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding-bottom: 0;
    z-index: 9999;
    border-radius: 0;
}

.video-player.fullscreen .player-ctrl {
    height: 50px;
    padding: 0 24px;
}

.video-player.fullscreen .big-play-btn {
    width: 160px;
    height: 160px;
}

/* --- Gift Bar (bottom-block) --- */
.bottom-block {
    display: flex;
    align-items: center;
    height: 64px;
    background: #fff;
    border-radius: 0 0 6px 6px;
}

.bottom-block .integral {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px;
    border-right: 1px solid #eee;
    min-width: 100px;
}

.bottom-block .integral-num {
    font-size: 20px;
    font-weight: 700;
    color: var(--color-primary);
}

.bottom-block .integral-name {
    font-size: 11px;
    color: #999;
}

.bottom-block .gift {
    flex: 1;
    overflow: hidden;
}

.bottom-block .gift-list {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
}

.bottom-block .gift-item {
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
}

.bottom-block .gift-item .gift-icon {
    width: 44px;
    height: 44px;
    transition: transform 0.15s;
}

.bottom-block .gift-item .gift-icon-css {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    font-size: 22px;
    background: linear-gradient(135deg, #fff3cd, #ffe69c);
    color: #d4a017;
    font-weight: 700;
    cursor: pointer;
    user-select: none;
}

.bottom-block .gift-item .gift-icon-css.gift-rocket {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    font-size: 26px;
}

.bottom-block .gift-item .gift-icon-css.gift-heart {
    background: linear-gradient(135deg, #fce4ec, #f8bbd0);
    color: #e91e63;
    font-size: 24px;
}

.bottom-block .gift-item .gift-icon-css.gift-crown {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    font-size: 26px;
}

.bottom-block .gift-item .gift-icon-css.gift-trophy {
    background: linear-gradient(135deg, #f3e5f5, #e1bee7);
    font-size: 26px;
}

.bottom-block .gift-item:hover .gift-icon {
    transform: scale(1.15);
}

.bottom-block .gift-item .gift-popup {
    display: none;
    position: absolute;
    bottom: 56px;
    left: 50%;
    transform: translateX(-50%);
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    padding: 12px 16px;
    white-space: nowrap;
    z-index: 30;
    text-align: center;
}

.bottom-block .gift-item:hover .gift-popup { display: block; }

.bottom-block .gift-popup::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid #fff;
}

.bottom-block .gift-popup .gift-name {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.bottom-block .gift-popup .gift-cost {
    font-size: 12px;
    color: #999;
    margin-top: 2px;
}

.bottom-block .gift-popup .gift-send-btn {
    margin-top: 8px;
    padding: 4px 20px;
    background: var(--color-primary);
    color: #000;
    border-radius: 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}

.bottom-block .gift-popup .gift-send-btn:hover {
    background: #e6b000;
}

.bottom-block .get-coin {
    padding: 0 16px;
    flex-shrink: 0;
}

.bottom-block .get-coin a {
    color: #999;
    font-size: 12px;
}

.bottom-block .get-coin a:hover { color: var(--color-primary); }

/* ===== Right: Chat Panel ===== */
.chat {
    width: 330px;
    background: #ededed;
    border-radius: 7px;
    position: relative;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    align-self: stretch;
}

/* Notice */
.chat .notice {
    height: 63px;
    padding: 14px;
    font-size: 14px;
    color: #666;
    background: #fff;
    border-radius: 6px 6px 0 0;
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

.chat .notice .notice-icon {
    width: 14px;
    height: 14px;
}

.chat .notice b { color: #333; margin-right: 4px; }

/* Chat Tabs */
.chat .tab {
    display: flex;
    height: 38px;
    line-height: 38px;
    background: #fff;
    border-top: 1px solid #e9e9e9;
    border-bottom: 1px solid #e9e9e9;
    flex-shrink: 0;
}

.chat .tab-item {
    flex: 1;
    text-align: center;
    font-size: 14px;
    color: #777;
    cursor: pointer;
    transition: color 0.2s;
    user-select: none;
}

.chat .tab-item:hover { color: #333; }

.chat .tab-item.tab-active {
    color: #000;
    font-weight: 600;
    position: relative;
}

.chat .tab-item.tab-active::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: var(--color-primary);
}

/* Chat Content */
.chat-center {
    flex: 1;
    min-height: 200px;
    overflow: hidden;
    position: relative;
}

.chat-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 8px 14px;
    background: #f4f4f4;
}

.chat-panel.active { display: block; }

.chat-panel::-webkit-scrollbar { width: 6px; }
.chat-panel::-webkit-scrollbar-thumb { background: rgba(0,0,0,.25); border-radius: 3px; }

.rank-panel {
    display: none;
    height: 100%;
    overflow-y: auto;
    padding: 20px 14px;
    background: #f4f4f4;
}

.rank-panel.active { display: block; }

.rank-empty {
    text-align: center;
    color: #aaa;
    font-size: 13px;
    padding-top: 60px;
}

/* Chat Messages */
.chat-msg {
    margin-bottom: 6px;
    font-size: 13px;
    line-height: 1.6;
    word-break: break-all;
    animation: fadeInUp 0.2s ease;
}

.chat-msg .msg-badge {
    display: inline-block;
    padding: 0 4px;
    border-radius: 2px;
    font-size: 10px;
    margin-right: 3px;
    vertical-align: middle;
}

.chat-msg .badge-lv {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.chat-msg .msg-name {
    color: #3c7ee5;
    font-weight: 500;
    margin-right: 3px;
    cursor: pointer;
}

.chat-msg .msg-name:hover { text-decoration: underline; }
.chat-msg .msg-text { color: #333; }

.chat-msg.gift {
    background: linear-gradient(90deg, rgba(248,194,27,0.08), transparent);
    padding: 4px 8px;
    border-radius: 4px;
}

.chat-msg.gift .gift-icon {
    display: inline-block;
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin: 0 2px;
}

.chat-msg.enter {
    color: #bbb;
    font-size: 12px;
}

/* Chat Bottom */
.chat-bottom {
    height: 104px;
    background: #fff;
    border-top: 1px solid #e9e9e9;
    border-radius: 0 0 6px 6px;
    padding: 13px;
    flex-shrink: 0;
}

.chat-tools {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.chat-tools .tool-btn {
    width: 22px;
    height: 22px;
    cursor: pointer;
    opacity: 0.4;
    transition: opacity 0.15s;
}

.chat-tools .tool-btn:hover { opacity: 0.7; }

.chat-input-row {
    display: flex;
    align-items: stretch;
    height: 52px;
    margin-top: 2px;
}

.chat-input-row .login-hint {
    width: 80%;
    height: 52px;
    padding: 5px 10px;
    border-radius: 4px 0 0 4px;
    border: 1px solid #d8d8d8;
    border-right: 0;
    font-size: 14px;
    line-height: 42px;
    color: #bbb;
    display: flex;
    align-items: center;
}

.chat-input-row .login-hint a {
    color: var(--color-primary);
    font-weight: 500;
}

.chat-input-row input {
    width: 80%;
    height: 52px;
    padding: 5px 10px;
    border-radius: 4px 0 0 4px;
    border: 1px solid #d8d8d8;
    border-right: 0;
    font-size: 14px;
    color: #333;
    outline: none;
    background: #fff;
}

.chat-input-row input::placeholder { color: #bbb; }

.chat-input-row .send-btn {
    width: 20%;
    height: 52px;
    background: #e5e5e5;
    border: 1px solid #e5e5e5;
    color: #777;
    border-radius: 0 4px 4px 0;
    font-size: 14px;
    text-align: center;
    line-height: 52px;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s;
    padding: 0;
}

.chat-input-row .send-btn:hover {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

/* ===== Below Sections (light bg) ===== */
.room-below {
    padding: 30px 0 60px;
}

/* Section Title */
.section-title-text {
    font-size: 22px;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
}

/* --- Anchor Schedule --- */
.anchor-schedule {
    margin-bottom: 40px;
}

.schedule-slider {
    display: flex;
    gap: 0;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
}

.schedule-card {
    flex: 1;
    padding: 16px 20px;
    border-right: 1px solid #e8e8e8;
    min-width: 200px;
}

.schedule-card:last-child { border-right: none; }

.schedule-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.schedule-header .schedule-title {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.schedule-header .schedule-time {
    font-size: 12px;
    color: #999;
}

.schedule-matches {
    margin-bottom: 12px;
}

.schedule-match {
    font-size: 13px;
    color: #666;
    padding: 4px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.schedule-match .match-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    flex-shrink: 0;
}

.schedule-match .match-dot.live {
    background: #fa3434;
    animation: pulse 1.5s infinite;
}

.schedule-book-btn {
    display: inline-block;
    padding: 4px 16px;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.schedule-book-btn:hover {
    background: var(--color-primary);
    color: #000;
}

.schedule-book-btn.booked {
    background: #f0f0f0;
    border-color: #ddd;
    color: #999;
    cursor: default;
}

/* --- Video Recommend --- */
.video-recommend {
    margin-bottom: 30px;
}

.recommend-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.recommend-grid .live-card { background: #fff; border-radius: 6px; overflow: hidden; }
.recommend-grid .live-card .card-cover { height: 120px; position: relative; overflow: hidden; }
.recommend-grid .live-card .card-cover img { width: 100%; height: 100%; object-fit: cover; }
.recommend-grid .live-card .card-title { padding: 8px 10px; font-size: 13px; color: #333; }

/* ===== Responsive ===== */
@media screen and (max-width: 1400px) {
    .chat { width: 280px; }
    .video-player { height: 366px; }
    .top-block { height: 80px; padding: 15px 20px; }
    .recommend-grid { grid-template-columns: repeat(4, 1fr); }
}

@media screen and (max-width: 1024px) {
    .live-room-box { flex-direction: column; padding: 0 10px; }
    .media { width: 100%; }
    .chat { width: 100%; height: 360px; margin-top: 10px; }
    .video-player { height: auto; padding-bottom: 56.25%; }
    .bottom-block { flex-wrap: wrap; height: auto; padding: 10px; }
    .recommend-grid { grid-template-columns: repeat(3, 1fr); }
    .schedule-slider { flex-wrap: wrap; }
    .schedule-card { min-width: 100%; border-right: none; border-bottom: 1px solid #e8e8e8; }
}

@media screen and (max-width: 768px) {
    .live-room { padding-top: calc(var(--header-height) + 6px); }
    .live-room-box { padding: 0 8px; }
    .top-block { flex-direction: column; align-items: flex-start; height: auto; gap: 10px; padding: 12px; }
    .top-block .anchor-info .anchor-name { font-size: 16px; }
    .top-block .anchor-info .anchor-desc { font-size: 12px; }
    .top-right-block { width: 100%; justify-content: flex-start; gap: 10px; }
    .chat { height: 320px; }
    .chat-msg-list { font-size: 13px; }
    .chat-input-row input { font-size: 14px; }
    .recommend-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .recommend-grid .live-card .card-cover { height: auto; aspect-ratio: 16 / 10; }
    .recommend-grid .card-title { font-size: 13px; padding: 8px 10px; }
    .bottom-block { flex-wrap: wrap; height: auto; padding: 8px; gap: 8px; }
    .bottom-block .gift-list { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .bottom-block .integral { min-width: auto; padding: 0 10px; font-size: 13px; }
    .bottom-block .get-coin { padding: 0 10px; }
    .room-below { padding: 16px 8px 40px; }
    .section-title-text { font-size: 16px; margin-bottom: 10px; }
}

/* ===== Broadcast Popup ===== */
.broadcast-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s;
}

.broadcast-popup {
    background: #fff;
    border-radius: 12px;
    max-width: 400px;
    width: 90%;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s;
}

.broadcast-popup .bp-title {
    padding: 20px 20px 12px;
    font-size: 18px;
    font-weight: 600;
    color: #333;
    text-align: center;
}

.broadcast-popup .bp-image {
    padding: 0 20px;
}

.broadcast-popup .bp-image img {
    width: 100%;
    border-radius: 8px;
}

.broadcast-popup .bp-content {
    padding: 12px 20px;
    font-size: 14px;
    color: #666;
    line-height: 1.6;
    text-align: center;
}

.broadcast-popup .bp-actions {
    padding: 12px 20px 20px;
    display: flex;
    gap: 12px;
    justify-content: center;
}

.broadcast-popup .bp-btn {
    padding: 10px 24px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.2s;
}

.broadcast-popup .bp-btn-primary {
    background: var(--color-primary);
    color: #fff;
    font-weight: 500;
}

.broadcast-popup .bp-btn-primary:hover {
    background: var(--color-primary-hover);
}

.broadcast-popup .bp-btn-close {
    background: #f0f0f0;
    color: #666;
}

.broadcast-popup .bp-btn-close:hover {
    background: #e0e0e0;
}

/* Gift icon text fallback */
.gift-icon-text {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--color-primary), var(--color-gold));
    border-radius: 50%;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
