/* ================= 语音直播专用样式 ================= */

/* 移动端触摸优化 - 完全参考期货游戏 */
html {
    -webkit-tap-highlight-color: rgba(0,0,0,0);
    -webkit-touch-callout: none;
    -ms-touch-action: pan-y; /* 允许垂直滚动 */
    touch-action: pan-y; /* 允许垂直滚动，禁止水平拖动 */
}

* {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

/* 允许特定元素滚动 */
.chat-messages, .host-sidebar-body, input, textarea {
    touch-action: pan-y;
    -webkit-overflow-scrolling: touch;
}

/* 防止整个页面被拖动 */
body, .container, .main-content {
    touch-action: pan-y;
    overscroll-behavior: contain;
}

/* 直播容器 - 使用Bootstrap container，与期货游戏保持一致 */
body {
    min-height: 100vh;
    min-height: var(--viewport-height, 100vh);
    overflow-x: hidden; /* 防止横向滚动 */
    position: relative; /* 防止body被拖动 */
}

/* 防止iOS Safari的橡皮筋效果 */
html, body {
    height: 100%;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* 直播间容器布局 - 参考聊天室样式，铺满全屏 */
.container {
    display: flex !important;
    flex-direction: column !important;
    /* 🔧 Safari 视口高度优化：使用动态视口单位和 CSS 变量回退 */
    min-height: 100vh; /* 默认回退值 */
    min-height: var(--viewport-height, 100vh); /* JS 动态计算回退 */
    padding: 0 15px 4px 15px !important; /* 上0 右15 下4 左15 */
    box-sizing: border-box !important; /* padding计算在内 */
    position: relative !important; /* 为侧边栏提供定位基准 */
    overflow-x: hidden !important; /* 防止横向溢出，允许垂直滚动 */
    /* 保持style.css中的800px max-width限制 */
}

/* 语音提示横幅 - 已禁用，默认隐藏 */
.audio-notice-banner {
    background: linear-gradient(135deg, #ff9800 0%, #ff5722 100%);
    color: white;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 10px;
    display: none !important; /* 强制隐藏，不再显示语音提示 */
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
    animation: slideDown 0.4s ease-out;
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.notice-content {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.notice-content i {
    font-size: 20px;
    animation: volumePulse 1.5s ease-in-out infinite;
}

@keyframes volumePulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }
}

.notice-content span {
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
}

.notice-close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.notice-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

/* 主要内容区域 - 让聊天区域能够填充空间 */
.main-content {
    flex: 1 1 auto; /* 允许填充可用空间，让聊天区域扩展 */
    display: flex;
    flex-direction: column;
    min-height: 0; /* 重要：允许flex子元素正确收缩 */
}

/* 聊天卡片容器 - 填充剩余空间 */
.main-content > .card.flex-fill {
    display: flex;
    flex-direction: column;
    min-height: 0; /* 重要：允许滚动生效 */
    flex: 1; /* 占据剩余所有空间 */
    margin-top: 8px !important; /* 覆盖Bootstrap的mt-2 */
    margin-bottom: 4px !important; /* 与输入区域最小间距 */
}

.main-content > .card.flex-fill > .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* 重要：允许滚动生效 */
    overflow: hidden; /* 防止内容溢出 */
    padding: 8px !important; /* 减少padding，避免太多空白 */
}

/* 输入区域固定到底部 - 参考聊天室样式 */
.live-input-area {
    margin-top: 0; /* 移除顶部间距 */
    margin-bottom: 0; /* 移除底部间距，紧贴底部 */
    flex-shrink: 0; /* 防止输入区域被压缩 */
    padding: 8px; /* 保持内边距 */
}

/* 顶部导航区域 - 完全参考期货样式 */
.welcome-text {
    text-align: left;
    font-size: 16px;
    color: #666;
    margin-bottom: 8px;
}

.welcome-text a {
    color: #007bff;
    text-decoration: none;
}

.back-link {
    margin-right: 10px;
    color: #007bff !important;
    font-weight: 500;
}

.logout-link {
    margin-left: 10px;
    color: #dc3545 !important;
    font-size: 14px;
}

.links-area {
    text-align: left;
    margin-bottom: 10px;
}

.links-area p {
    font-size: 16px;
    margin-bottom: 5px;
}

.links-area a {
    color: #007bff;
    text-decoration: none;
    margin: 0 3px;
}

/* 房间状态显示 - 🔧 隐藏独立区域，改为合并到主播台头部 */
.room-status {
    display: none;
}

.status-info h5 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin-bottom: 4px;
}

/* 状态指示器 */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.status-indicator.status-live {
    background: #dc3545;
    animation: pulse 2s infinite;
}

.status-indicator.status-waiting {
    background: #ffc107;
}

.status-indicator.status-ended {
    background: #6c757d;
}

@keyframes pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.2); }
    100% { opacity: 1; transform: scale(1); }
}

/* 卡片样式 - 完全参考期货游戏 */
.card {
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.05);
    transition: all 0.2s ease;
}

.card:hover {
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0,123,255,0.15);
}

.card-body {
    padding: 8px 10px !important;
}

.card h6 {
    font-size: 14px;
    font-weight: 600;
    color: #666;
    margin-bottom: 8px;
}

/* 主播网格布局 - 超紧凑横向布局 */
.hosts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    min-height: auto;
}

.empty-host-state {
    grid-column: 1 / -1;
    padding: 6px 0 !important;
}

/* 主播卡片 - 横向紧凑布局 */
.host-card {
    background: linear-gradient(135deg, #1e88e5 0%, #1565c0 100%);
    color: white;
    border-radius: 8px;
    padding: 6px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(30,136,229,0.3);
}

.host-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(102,126,234,0.35);
}

.host-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    font-size: 14px;
    font-weight: bold;
    flex-shrink: 0;
}

.host-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.host-status {
    font-size: 11px;
    opacity: 0.9;
    white-space: nowrap;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 状态指示器 - 小圆点 */
.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
    display: inline-block;
}

.status-indicator.active {
    background: #4caf50;
    box-shadow: 0 0 8px rgba(76, 175, 80, 0.6);
    animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.status-text {
    line-height: 1;
}

/* 音频切换按钮 - 紧凑版 */
.audio-toggle-btn {
    margin-top: 4px;
    padding: 4px 12px;
    background: linear-gradient(135deg, #ffa726 0%, #ff6f00 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.8);
    border-radius: 15px;
    color: white;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
    animation: buttonPulse 2s ease-in-out infinite;
    position: relative;
}

/* 脉冲呼吸灯动画 */
@keyframes buttonPulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 12px rgba(255, 167, 38, 0.4);
    }
    50% {
        transform: scale(1.08);
        box-shadow: 0 6px 20px rgba(255, 167, 38, 0.8);
    }
}

.audio-toggle-btn::before {
    content: '';
    position: absolute;
    top: -4px;
    left: -4px;
    right: -4px;
    bottom: -4px;
    border-radius: 25px;
    background: linear-gradient(135deg, #ffa726 0%, #ff6f00 100%);
    opacity: 0;
    animation: ringPulse 2s ease-in-out infinite;
    z-index: -1;
}

@keyframes ringPulse {
    0%, 100% {
        opacity: 0;
        transform: scale(1);
    }
    50% {
        opacity: 0.3;
        transform: scale(1.1);
    }
}

.audio-toggle-btn:hover {
    background: linear-gradient(135deg, #ffb74d 0%, #ff8f00 100%);
    transform: scale(1.05);
    animation: none; /* 悬停时停止动画 */
}

.audio-toggle-btn.active {
    background: linear-gradient(135deg, #66bb6a 0%, #43a047 100%);
    border-color: rgba(255, 255, 255, 0.9);
    box-shadow: 0 4px 12px rgba(102, 187, 106, 0.4);
    animation: none; /* 激活后停止动画 */
}

.audio-toggle-btn.active:hover {
    background: linear-gradient(135deg, #81c784 0%, #66bb6a 100%);
}

/* 语音状态指示器 */
.voice-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #dc3545;
}

.voice-indicator.speaking {
    background: #28a745;
    animation: voice-pulse 1s infinite;
}

@keyframes voice-pulse {
    0% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.7; transform: scale(1.3); }
    100% { opacity: 1; transform: scale(1); }
}

/* 🔧 新增：语音波纹动画指示器 */
.voice-wave-indicator {
    display: flex;
    align-items: center;
    gap: 3px;
    height: 20px;
}

.voice-wave-indicator .wave-bar {
    width: 3px;
    background: linear-gradient(180deg, #4caf50, #81c784);
    border-radius: 2px;
    animation: wave-animation 1.2s ease-in-out infinite;
}

.voice-wave-indicator .wave-bar:nth-child(1) {
    height: 8px;
    animation-delay: 0s;
}

.voice-wave-indicator .wave-bar:nth-child(2) {
    height: 14px;
    animation-delay: 0.2s;
}

.voice-wave-indicator .wave-bar:nth-child(3) {
    height: 10px;
    animation-delay: 0.4s;
}

@keyframes wave-animation {
    0%, 100% {
        transform: scaleY(1);
        opacity: 0.8;
    }
    50% {
        transform: scaleY(1.5);
        opacity: 1;
    }
}

/* 聊天消息区域 */
.chat-messages {
    flex: 1; /* 占据所有剩余空间 */
    min-height: 0; /* 允许flex正确收缩 */
    overflow-y: auto;
    overflow-x: hidden;
    font-size: 14px;
    padding: 8px;
    display: flex;
    flex-direction: column;
    -webkit-overflow-scrolling: touch;
}

/* 🔧 隐藏"欢迎来到直播间"默认提示 */
.chat-messages > .text-center.text-muted.small.py-3 {
    display: none;
}

/* 聊天消息滚动条样式 */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.chat-message {
    padding: 4px 8px;
    margin: 2px 0;
    border-radius: 4px;
    animation: messageSlideIn 0.3s ease;
}

.chat-message .username {
    color: #007bff;
    font-weight: 600;
    margin-right: 6px;
}

.chat-message .content {
    color: #333;
}

.chat-message .time {
    color: #999;
    font-size: 11px;
    margin-left: 6px;
}

@keyframes messageSlideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 听众列表 */
.listeners-list {
    max-height: 150px;
    overflow-y: auto;
    font-size: 14px;
}

.listener-item {
    display: inline-block;
    margin: 2px 4px;
    padding: 2px 8px;
    background: rgba(0,123,255,0.1);
    border-radius: 12px;
    color: #007bff;
    font-size: 12px;
}

/* 直播间输入区域 - 紧贴聊天区域 */
.live-input-area {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    position: relative;
    margin-bottom: 0 !important; /* 确保贴底 */
}


/* 聊天输入容器 */
.chat-input-container {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
    align-items: center;
}

.chat-input {
    flex: 1;
    border-radius: 20px;
    border: 1px solid #ddd;
    padding: 8px 16px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.chat-input:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0,123,255,0.25);
}

/* 发送按钮样式 */
.btn-send {
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0,123,255,0.3);
    flex-shrink: 0;
}

.btn-send:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.4);
}

.btn-send:active {
    transform: translateY(0);
}

.btn-gift {
    background: linear-gradient(135deg, #ff6b6b, #ee5a52);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(255,107,107,0.3);
    flex-shrink: 0;
}

.btn-gift:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(255,107,107,0.4);
    color: white;
}

/* 控制按钮组 */
.control-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
}

.btn-control {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.btn-control:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.mic-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
}

.mic-btn.muted {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.speaker-btn {
    background: linear-gradient(135deg, #007bff, #0056b3);
}

.speaker-btn.muted {
    background: linear-gradient(135deg, #6c757d, #5a6268);
}

.request-mic-btn {
    background: linear-gradient(135deg, #ffc107, #e0a800);
}

.leave-btn {
    background: linear-gradient(135deg, #dc3545, #c82333);
}

.leave-btn[data-action="close"] {
    background: linear-gradient(135deg, #e74c3c, #c0392b);
    animation: closeBtnPulse 2s infinite;
}

@keyframes closeBtnPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.8; }
}

/* 主播控制区域 */
.host-controls {
    border-top: 1px solid #e0e0e0;
    padding-top: 12px;
}

.btn-start-live {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.btn-start-live:hover {
    background: linear-gradient(135deg, #218838, #1e7e34);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
    color: white;
}

.btn-stop-live {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
    border: none;
    border-radius: 25px;
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
    animation: livePulse 2s infinite;
}

.btn-stop-live:hover {
    background: linear-gradient(135deg, #c82333, #a71e2a);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
    color: white;
}

@keyframes livePulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.85; }
}

/* 礼物模态框样式 - 参考期货的买入模态框 */
.gift-modal-content {
    border-radius: 20px;
    border: none;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a52 100%);
}

.gift-modal-header {
    background: linear-gradient(135deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0.1) 100%);
    border: none;
    backdrop-filter: blur(10px);
    padding: 25px;
    border-bottom: 1px solid rgba(255,255,255,0.2);
}

.gift-modal-title {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
}

.gift-icon {
    font-size: 32px;
    background: rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 8px;
    backdrop-filter: blur(10px);
}

.gift-modal-title h5 {
    font-size: 24px;
    font-weight: bold;
    color: white;
}

.gift-modal-title small {
    color: rgba(255,255,255,0.8) !important;
}

.gift-modal-body {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    padding: 30px;
}

.balance-display {
    background: rgba(0,123,255,0.1);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 25px;
}

/* 礼物网格 */
.gift-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    max-height: 350px;
    overflow-y: auto;
}

@media (min-width: 768px) {
    .gift-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.gift-item {
    background: rgba(0,123,255,0.1);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    min-height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.gift-item:hover {
    background: rgba(0,123,255,0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.2);
}

.gift-item.selected {
    background: #007bff;
    color: white;
    border-color: #0056b3;
    transform: scale(1.05);
}

.gift-emoji {
    font-size: 24px;
    margin-bottom: 6px;
    display: block;
}

.gift-name {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.gift-price {
    font-size: 11px;
    color: #666;
}

.gift-item.selected .gift-price {
    color: rgba(255,255,255,0.9);
}

.gift-modal-footer {
    background: rgba(255,255,255,0.95);
    border: none;
    padding: 20px 30px;
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* 礼物特效层 */
.gift-effect-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
}

.gift-effect-float {
    position: absolute;
    font-size: 24px;
    font-weight: bold;
    color: #ff6b6b;
    animation: giftFloat 3s ease-out forwards;
    pointer-events: none;
}

@keyframes giftFloat {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(0);
    }
    20% {
        opacity: 1;
        transform: scale(1.2) translateY(-20px);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(-100px);
    }
}

/* 加载状态 - 参考期货样式 */
.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ================= 直播列表页面专用样式 ================= */

/* 直播间统计显示 */
.live-stats {
    margin-bottom: 10px;
    padding: 12px;
    background: rgba(0, 123, 255, 0.1);
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    text-align: center;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.stat-value {
    font-size: 20px;
    font-weight: bold;
    color: #007bff;
    margin-bottom: 2px;
}

.stat-value.live-count {
    color: #dc3545;
    animation: pulse 2s infinite;
}

.stat-label {
    font-size: 12px;
    color: #666;
}

/* 房间卡片样式 - 现代化设计 */
.room-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,123,255,0.2);
}

.room-card-live {
    border: 2px solid #dc3545;
}

.room-card-live:hover {
    box-shadow: 0 8px 24px rgba(220,53,69,0.3);
}

/* 房间封面区域 */
.room-cover {
    position: relative;
    height: 120px;
    overflow: hidden;
}

.cover-gradient {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: all 0.3s ease;
}

.live-gradient {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    animation: gradientShift 3s ease infinite;
}

.waiting-gradient {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
}

@keyframes gradientShift {
    0%, 100% { filter: hue-rotate(0deg); }
    50% { filter: hue-rotate(10deg); }
}

.cover-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.room-status-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-live {
    background: rgba(220, 53, 69, 0.9);
    color: white;
}

.status-waiting {
    background: rgba(108, 117, 125, 0.8);
    color: white;
}

.pulse-dot {
    font-size: 8px;
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.room-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

/* 房间信息区域 */
.room-info {
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.room-title {
    font-size: 15px;
    font-weight: 600;
    color: #222;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.room-creator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.room-creator i {
    color: #007bff;
}

.room-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    padding-top: 8px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.listener-count {
    display: flex;
    align-items: center;
    gap: 4px;
    color: #007bff;
    font-weight: 500;
}

.listener-count i {
    font-size: 14px;
}

.room-id {
    color: #999;
    font-family: monospace;
    font-size: 11px;
}

/* 空状态样式 */
.empty-state {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

/* 直播列表页面响应式设计 */
@media (max-width: 576px) {
    .stats-grid {
        gap: 10px;
    }

    .stat-value {
        font-size: 18px;
    }

    .stat-label {
        font-size: 11px;
    }

    .live-stats {
        padding: 10px;
    }

    .room-cover {
        height: 100px;
    }

    .cover-icon {
        font-size: 36px;
    }

    .room-title {
        font-size: 14px;
    }

    .room-creator {
        font-size: 12px;
    }

    .room-meta {
        font-size: 11px;
    }
}

/* 中等屏幕优化 */
@media (min-width: 768px) and (max-width: 991px) {
    .room-cover {
        height: 110px;
    }
}

/* 大屏幕优化 */
@media (min-width: 1200px) {
    .room-cover {
        height: 130px;
    }

    .cover-icon {
        font-size: 52px;
    }
}

/* 响应式设计 - 完全参考期货游戏 */
@media (max-width: 576px) {
    .container {
        padding: 0 10px 0 10px !important; /* 移动端减少左右padding */
    }

    .live-input-area {
        padding: 8px; /* 小屏保持合适的padding */
        margin-bottom: 0; /* 确保贴底 */
    }

    .card-body {
        padding: 6px 8px !important;
    }

    .hosts-grid {
        grid-template-columns: 1fr; /* 移动端单列 */
        gap: 6px;
    }

    .host-card {
        padding: 5px 8px;
    }

    .host-avatar {
        width: 28px;
        height: 28px;
        font-size: 12px;
        margin: 0;
    }

    .host-name {
        font-size: 12px;
    }

    .host-status {
        font-size: 10px;
    }

    .audio-toggle-btn {
        margin-top: 3px;
        padding: 3px 10px;
        font-size: 10px;
    }

    .chat-messages {
        font-size: 13px;
        /* 移除固定高度限制，让它填充所有可用空间 */
    }

    .listeners-list {
        max-height: 120px;
        font-size: 13px;
    }

    .bottom-actions {
        padding: 10px;
    }

    .btn-control {
        width: 40px;
        height: 40px;
        font-size: 14px;
    }

    .btn-send {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .btn-gift {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }

    .gift-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }

    .gift-item {
        padding: 10px 6px;
    }

    .gift-emoji {
        font-size: 20px;
    }

    .gift-name {
        font-size: 11px;
    }

    .gift-price {
        font-size: 10px;
    }
}

/* ================= 主播控制侧边栏样式 ================= */

/* 🔧 主播区域头部 - 简洁版：只显示标题和人数 */
.host-area-header {
    padding: 8px 0;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid #e0e0e0;
}

.host-area-header .room-title {
    color: #333;
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.host-area-header .listener-count {
    color: #666;
    font-size: 13px;
    white-space: nowrap;
}

.host-area-header .listener-count i {
    margin-right: 4px;
    color: #007bff;
}

.host-area-header .host-menu-btn {
    border-radius: 50%;
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.host-area-header .host-menu-btn:hover {
    background-color: rgba(255, 255, 255, 0.3);
    color: white;
    border-color: transparent;
}

/* 侧边栏切换按钮 */
.floating-menu-btn {
    position: absolute;
    top: 56px;
    right: 16px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 123, 255, 0.35);
    z-index: 1060;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-menu-btn:hover,
.floating-menu-btn:focus {
    color: #fff;
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 10px 24px rgba(0, 123, 255, 0.45);
    outline: none;
}

.floating-menu-btn.active {
    transform: translateY(-2px) scale(1.05) rotate(90deg);
}

.floating-menu-btn i {
    font-size: 1.25rem;
}

@media (max-width: 576px) {
    .floating-menu-btn {
        position: fixed;
        top: 16px;
        right: 16px;
        width: 44px;
        height: 44px;
    }
}

/* 侧边栏样式 */
.host-sidebar {
    position: fixed;
    top: 0;
    right: -400px; /* 增加隐藏距离，确保完全不可见 */
    width: 320px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.1);
    z-index: 1050;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: block; /* 确保元素存在但位置在屏幕外 */
}

.host-sidebar.show {
    right: 0;
}

/* 电脑端侧边栏定位调整 - 现在侧边栏在容器内 */
@media (min-width: 768px) {
    /* 确保容器具有正确的定位上下文 */
    .container {
        position: relative;
        overflow: hidden; /* 隐藏超出容器的部分，确保侧边栏完全不可见 */
    }

    /* 侧边栏相对于容器定位 */
    .host-sidebar {
        position: absolute;
        top: 0;
        right: -400px; /* 完全隐藏在容器右侧外面，增加隐藏距离 */
        width: 320px;
        height: 100%; /* 高度跟随容器 */
        transition: right 0.3s ease;
        z-index: 1050;
        display: block; /* 确保默认是隐藏状态 */
    }

    .host-sidebar.show {
        right: 0; /* 滑入到容器右边缘 */
    }

}

.host-sidebar-header {
    padding: 20px;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.host-sidebar-header h5 {
    margin: 0;
    font-weight: 600;
}

.host-sidebar-header .btn-close {
    background: rgba(255,255,255,0.2);
    opacity: 1;
    border-radius: 50%;
    width: 32px;
    height: 32px;
}

.host-sidebar-header .btn-close:hover {
    background: rgba(255,255,255,0.3);
}

.host-sidebar-body {
    padding: 20px;
}

.control-group {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.control-group:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.control-group-title {
    font-size: 14px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 侧边栏按钮样式 */
.btn-control-sidebar {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #495057;
    padding: 12px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-control-sidebar:hover {
    background: #e9ecef;
    border-color: #adb5bd;
    color: #495057;
    transform: translateY(-1px);
}

.btn-control-sidebar.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.btn-control-sidebar.mic-btn.muted {
    background: #dc3545;
    border-color: #dc3545;
    color: white;
}

.btn-control-sidebar.speaker-btn.muted {
    background: #6c757d;
    border-color: #6c757d;
    color: white;
}

.btn-control-sidebar i {
    width: 16px;
    text-align: center;
}

/* 统计信息样式 */
.stats-info {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.stat-item {
    text-align: center;
}

.stat-item small {
    display: block;
    margin-bottom: 5px;
}

.stat-item .h6 {
    color: #007bff;
    font-weight: 600;
}

/* 侧边栏遮罩层 */
.sidebar-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1049;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.sidebar-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 移动端侧边栏适配 */
@media (max-width: 576px) {
    .host-sidebar {
        width: 85vw; /* 使用视口宽度的85% */
        max-width: 300px;
        right: -85vw;
        position: fixed; /* 移动端使用fixed定位 */
        z-index: 1051;
    }

    .host-sidebar.show {
        right: 0;
    }

    .sidebar-overlay {
        position: fixed; /* 移动端遮罩层也使用fixed */
        z-index: 1050;
    }

    .host-sidebar-header {
        padding: 15px;
    }

    .host-sidebar-body {
        padding: 15px;
    }

    .control-group {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }

    .control-group-title {
        font-size: 13px;
        margin-bottom: 10px;
    }

    .btn-control-sidebar {
        padding: 10px 14px;
        font-size: 14px;
    }

    /* 移动端容器调整 */
    .container {
        padding-left: 15px;
        padding-right: 15px;
        /* 🔧 Safari 视口高度优化：强制使用动态视口高度，移除 max-height 限制 */
        height: 100vh !important; /* 默认回退值 */
        height: -webkit-fill-available !important; /* Safari 15 兼容 */
        height: 100dvh !important; /* 现代浏览器动态视口高度 */
        height: var(--viewport-height, 100vh) !important; /* JS 动态计算回退 */
    }

    /* 移动端聊天区域优化 */
    .chat-messages {
        min-height: 200px; /* 小屏幕最小高度 */
    }

    /* 移动端主播台区域 */
    .host-area-header {
        padding: 6px 0;
    }

    .host-area-header .room-title {
        font-size: 13px;
    }

    .host-area-header .listener-count {
        font-size: 12px;
    }

    /* 移动端隐藏底部控制按钮 */
    .control-buttons {
        display: none; /* 移动端完全隐藏底部控制按钮 */
    }

    /* 移动端只保留输入框和礼物按钮 */
    .live-input-area {
        padding: 10px 15px;
        /* 🔧 Safari 安全区域适配：为 iPhone 刘海屏留出底部空间（不再额外放大间距） */
        padding-bottom: max(10px, env(safe-area-inset-bottom));
        background: white;
        border-top: 1px solid #e9ecef;
    }

    /* 移动端输入框 */
    .chat-input-container {
        gap: 8px;
    }

    .chat-input {
        font-size: 16px; /* 防止iOS缩放 */
        min-height: 40px;
    }
}

/* ================= 创建直播间页面专用样式 ================= */

/* 房间类型选择卡片 */
.room-type-card {
    border: 3px solid #dee2e6;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    background: #f8f9fa;
}

.room-type-card:hover {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.15);
}

.room-type-card.selected {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.15);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.2);
}

.room-type-icon {
    font-size: 2.5rem;
    color: #6c757d;
    margin-bottom: 12px;
}

.room-type-card.selected .room-type-icon {
    color: #007bff;
}

.room-type-card h6 {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.room-type-card.selected h6 {
    color: #007bff;
}

.room-type-card .text-muted {
    color: #6c757d !important;
    font-size: 14px;
}

.room-type-card.selected .text-muted {
    color: #495057 !important;
}

/* 隐私切换开关 */
.privacy-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px solid #dee2e6;
}

.privacy-toggle span {
    font-size: 15px;
    font-weight: 600;
    color: #495057;
}

.privacy-toggle .form-check {
    margin: 0;
}

.privacy-toggle .form-check-input {
    width: 50px;
    height: 26px;
    cursor: pointer;
}

.privacy-toggle .form-check-input:checked {
    background-color: #007bff;
    border-color: #007bff;
}

/* 字符计数 */
.char-count {
    font-size: 13px;
    color: #6c757d;
    text-align: right;
    margin-top: 5px;
}

/* 表单标签加粗 */
.form-label {
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    font-size: 15px;
}

.form-label i {
    color: #007bff;
    margin-right: 4px;
}

/* 响应式优化 */
@media (max-width: 576px) {
    .room-type-card {
        padding: 16px;
    }

    .room-type-icon {
        font-size: 2rem;
    }

    .room-type-card h6 {
        font-size: 15px;
    }

    .privacy-toggle {
        padding: 10px;
    }

    .privacy-toggle span {
        font-size: 14px;
    }
}
/* ================= 创建直播间页面优化 ================= */

/* 创建房间页面 - 紧凑优化版 */
.create-room-container {
    min-height: 100vh;
    display: flex !important;
    flex-direction: column !important;
    padding: 15px !important;
    overflow-y: auto !important;
    height: auto !important;
    max-height: none !important;
}

.create-room-card {
    margin: auto;
    max-width: 500px;
    width: 100%;
    box-shadow: 0 4px 20px rgba(0,123,255,0.15) !important;
}

.create-room-card .card-body {
    padding: 20px !important;
}

/* 紧凑的隐私切换 */
.create-room-card .privacy-toggle {
    padding: 10px 12px;
    gap: 10px;
}

.create-room-card .privacy-label {
    font-size: 14px;
    font-weight: 500;
}

.create-room-card .form-check-input {
    width: 45px;
    height: 24px;
}

/* 创建按钮样式 */
.create-room-card .btn-primary {
    background: linear-gradient(135deg, #007bff, #0056b3);
    border: none;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0,123,255,0.3);
    transition: all 0.3s ease;
}

.create-room-card .btn-primary:hover {
    background: linear-gradient(135deg, #0056b3, #004085);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,123,255,0.4);
}

/* 移动端优化 */
@media (max-width: 576px) {
    .create-room-container {
        padding: 10px !important;
    }
    
    .create-room-card .card-body {
        padding: 15px !important;
    }
    
    .create-room-card h4 {
        font-size: 20px;
    }
    
    .create-room-card .fa-microphone {
        font-size: 1.5rem !important;
    }
    
    .create-room-card .privacy-toggle {
        flex-direction: column;
        text-align: center;
    }
    
    .create-room-card .form-check {
        order: 2;
    }
}



