/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* 头部 */
.header {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    color: #667eea;
    margin: 0;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.username {
    font-size: 14px;
    color: #333;
}

.back-btn {
    color: #667eea;
    text-decoration: none;
    font-size: 16px;
}

.live-title {
    margin: 0;
    font-size: 1.2rem;
    color: #333;
}

.header .container {
    display: flex;
    align-items: center;
    gap: 20px;
}

.viewers-info {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-top: 8px;
    font-size: 13px;
    color: #666;
    flex-wrap: wrap;
}

.viewers-info .info-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    white-space: nowrap;
}

.viewers-info .info-item strong {
    color: #667eea;
    font-weight: 600;
    margin-left: 4px;
}

/* 当前在线人数特殊样式 */
#currentViewers {
    color: #ff4757;
}

#currentViewers strong {
    color: #ff4757 !important;
    font-weight: 600;
}

/* 按钮 */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5568d3;
}

.btn-small {
    padding: 4px 8px;
    font-size: 12px;
}

/* 主要内容 */
.main-content {
    padding-top: 40px;
    padding-bottom: 40px;
}

/* 话题分类 */
.topics-section {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.topic-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.topic-tab {
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    text-decoration: none;
    color: #333;
    transition: all 0.3s;
}

.topic-tab:hover,
.topic-tab.active {
    background: #667eea;
    color: white;
}

/* 搜索 */
.search-section {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.search-form {
    display: flex;
    gap: 10px;
    max-width: 400px;
    width: 100%;
}

.search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

/* 直播列表 */
.streams-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 24px;
    margin-top: 30px;
}

.stream-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s, box-shadow 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.stream-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.stream-cover {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #f0f0f0;
    overflow: hidden;
}

.stream-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stream-status {
    position: absolute;
    top: 10px;
    right: 10px;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-live {
    background: #ff4757;
    color: white;
}

.status-ended {
    background: #747d8c;
    color: white;
}

.status-upcoming {
    background: #ffa502;
    color: white;
}

.stream-info {
    padding: 16px;
}

.stream-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stream-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #999;
}

.topic-name {
    background: #f0f0f0;
    padding: 2px 8px;
    border-radius: 4px;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: white;
    font-size: 18px;
}

/* 播放页 */
.player-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    margin-top: 20px;
}

.player-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
}

.video-container {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.video-player {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
}

.player-error {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 20px 30px;
    border-radius: 8px;
    z-index: 10;
    text-align: center;
    max-width: 80%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-error::before {
    content: '⚠️ ';
    font-size: 24px;
    display: block;
    margin-bottom: 10px;
}

.action-buttons {
    margin-top: 20px;
}

.description-section {
    margin-top: 20px;
}

.description-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 10px;
    background: #f5f5f5;
    border-radius: 4px;
}

.description-content {
    margin-top: 10px;
    padding: 10px;
}

/* 聊天区 */
.chat-section {
    background: white;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
}

.chat-header h3 {
    margin: 0;
    font-size: 1.1rem;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 20px;
}

.chat-message {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.message-content {
    flex: 1;
}

.message-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.message-nickname {
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

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

.message-text {
    font-size: 14px;
    color: #666;
    word-break: break-word;
}

.chat-input {
    border-top: 1px solid #eee;
    padding-top: 20px;
}

.chat-input input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 10px;
}

.blacklist-notice {
    color: #ff4757;
    font-size: 12px;
    margin-top: 5px;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
}

.modal-content {
    background: white;
    margin: 5% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 20px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.qrcode-container {
    text-align: center;
    padding: 20px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qrcode-container #qrcode {
    display: inline-block;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.qrcode-container .loading {
    color: #666;
    font-size: 14px;
}

.qrcode-container .error {
    color: #f44336;
    font-size: 14px;
    padding: 20px;
}

.qrcode-container img {
    width: 200px;
    height: 200px;
    margin-bottom: 10px;
}

.loading {
    padding: 40px;
    text-align: center;
}

.error {
    color: #ff4757;
    text-align: center;
    padding: 20px;
}

/* 响应式 */
@media (max-width: 1024px) {
    .player-layout {
        grid-template-columns: 1fr;
    }
    
    .chat-section {
        height: 400px;
    }
}

