﻿:root {
    --bg-grey: #f4f4f4;
}

html, body { 
    height: 100%; 
    margin: 0; 
    padding: 0; 
    overflow: hidden; 
}

body {
    display: flex;
    flex-direction: column;
    background-color: var(--bg-color);
}

.header {
    flex-shrink: 0;
}

.header-left {
    display: flex !important;
}

/* --- 移动端样式 (默认) --- */
.main-layout { 
    display: flex; 
    flex-direction: column; 
    flex: 1;
    min-height: 0;
    overflow: hidden; 
}

.left-content { 
    flex-shrink: 0;
    background: #fff;
}

.player-section { 
    width: 100%; 
    aspect-ratio: 16/9; 
    background: #000; 
    position: relative; 
}

/* 无信号提示样式 */
.no-streams {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #888;
    font-size: 1.1rem;
    font-weight: 600;
    flex-direction: column;
    gap: 15px;
}

.no-streams::before {
    content: "📺";
    font-size: 2.5rem;
    opacity: 0.5;
}

@media (min-width: 1024px) {
    .no-streams {
        font-size: 1.3rem;
    }
}

.player-container, #player-iframe { width: 100%; height: 100%; border: none; }

/* 信号切换按钮样式 */
.stream-buttons {
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
    gap: 10px; 
    padding: 12px 15px;
    background: #fff;
    border-top: 1px dashed #eee;
    flex-shrink: 0;
    -webkit-overflow-scrolling: touch; 
}

.stream-btn {
    flex: 0 0 auto;
    padding: 6px 16px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 20px; 
    font-size: 0.85rem;
    color: #495057;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.stream-btn:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.stream-btn.active {
    background: var(--accent-yellow);
    color: #fff;
    border-color: var(--accent-yellow);
}

/* 移动端横向滚动条样式 */
@media (max-width: 1023px) {
    .stream-btn {
        flex: 0 0 auto;
        padding: 2px 8px;
    }
    .stream-buttons {
        scrollbar-width: thin; /* Firefox */
        scrollbar-color: #ccc transparent;
        padding: 4px 8px;
    }
    .stream-buttons::-webkit-scrollbar {
        display: block;
        height: 4px; /* 滚动条高度 */
    }
    .stream-buttons::-webkit-scrollbar-track {
        background: transparent;
    }
    .stream-buttons::-webkit-scrollbar-thumb {
        background-color: #ddd;
        border-radius: 10px;
    }
}

/* 信号下方赛事信息条 */
.match-info-bar {
    display: flex;
    align-items: center;
    padding: 0 15px; 
    background: #fff;
    position: relative; 
    height: 38px; 
    border-top: 1px dashed #eee;
    flex-shrink: 0;
}
.info-left-labels {
    position: absolute;
    left: 10px; 
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column; 
    gap: 1px;
    align-items: flex-start;
    z-index: 1;
}
.info-label {
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.6rem;
    font-weight: bold;
    white-space: nowrap;
}
.info-time { color: #e65100; padding: 0; }
.info-event { background: #f0f2f5; color: #666; border-radius: 4px; }

.info-team {
    font-size: 0.9rem;
    font-weight: bold;
    color: #333;
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    flex: 1;
}

.team-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.info-home { 
    justify-content: flex-end; 
    margin-right: 0; 
}
.info-away { 
    justify-content: flex-start; 
    margin-left: 0; 
}

/* 详情页球队Logo基础样式 */
.team-logo {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 800;
    flex-shrink: 0;
    overflow: hidden;
}

.team-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.team-logo.img-logo {
}

/* 详情页球队Logo样式 - 移动端默认隐藏 */
.match-info-bar .team-logo {
    display: none;
}

.info-score {
    width: 75px; 
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
.info-score .score { font-size: 1rem; color: var(--accent-yellow); font-weight: 900; }
.info-score .vs { font-size: 1rem; color: #ccc; font-weight: bold; }

/* 聊天区域滚动修复 */
.right-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    background: #f0f0f0;
    overflow: hidden;
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    overflow: hidden;
}

.announcement-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 4px 6px;
    font-size: 13px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    position: relative;
    flex-shrink: 0;
}
.announcement-bar::before {
    content: "📣";
    font-size: 14px;
    flex-shrink: 0;
}
.announcement-text {
    flex: 1;
    line-height: 1.4;
    text-align: left;
}

.announcement-text a {
    color: #ffeb3b;
    text-decoration: none;
    font-weight: 600;
}

/* --- Modals --- */
.username-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.username-modal-content {
    background: white;
    padding: 20px;
    border-radius: 12px;
    width: 90%;
    max-width: 320px;
}
.username-modal-content h3 {
    margin: 0 0 15px;
    font-size: 18px;
    color: #333;
}
.username-input {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    margin: 15px 0;
    outline: none;
    box-sizing: border-box;
}
.username-error {
    color: #f44336;
    font-size: 12px;
    margin-top: -10px;
    margin-bottom: 10px;
    display: none;
}
.username-error.show { display: block; }
.username-modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}
.username-modal-btn {
    padding: 6px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
}
.username-modal-btn.primary { background: #667eea; color: white; }
.username-modal-btn.secondary { background: #f0f0f0; color: #666; }

.logout-confirm-text {
    margin-bottom: 20px;
    color: #666;
    font-size: 14px;
}

.chat-messages {
    flex: 1;
    min-height: 0; 
    overflow-y: auto !important; 
    overflow-x: hidden !important;
    padding: 5px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #888 #f1f1f1;
}
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-thumb { background-color: #ccc; border-radius: 3px; }

.chat-input-area {
    background: white;
    border-top: 1px solid #e0e0e0;
    padding: 8px 10px;
    display: flex;
    flex-direction: row; 
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.chat-input-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1; 
    min-width: 0;
}
.chat-input {
    flex: 1;
    min-width: 40px;
    padding: 7px 12px;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 13px;
    outline: none;
    background: #fff;
}
.send-btn {
    padding: 6px 12px;
    background: #667eea;
    color: white;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.username-display { 
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
    flex-shrink: 0;
}
.logout-btn {
    padding: 4px 10px;
    background: #f0f0f0;
    color: #999;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    font-size: 11px;
    white-space: nowrap;
}

.message-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 5px 5px;
    font-size: 12px; 
    line-height: 1.6;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.message-item .avatar {
    width: 22px; 
    height: 22px;
    border-radius:100%; 
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 10px;
    color: white;
    flex-shrink: 0;
    margin-top: 1px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.message-item .msg-body {
    flex: 1;
    min-width: 0;
}

.message-item .nickname {
    color: #555; 
    font-weight: 500;
    margin-right: 5px;
}

.message-item .content-text {
    color: #333;
    word-break: break-all;
    letter-spacing: 0.2px;
}

.message-item.own {
    background: #f8f9ff;
    border-left-color: #667eea;
}

.message-item.own .nickname {
    color: #667eea;
}

.message-item.own .content-text {
    color: #1a1a1a;
}

@media (min-width: 1024px) {
    .message-item {
        font-size: 12px; 
    }
}
.avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: white;
}

/* --- PC端样式适配 --- */
@media (min-width: 1024px) {
    body { 
        background-color: var(--bg-color); 
        height: auto; 
        overflow: auto; 
    }
    
    .main-layout { 
        flex: none; 
        width: 100%;
        flex-direction: row; 
        max-width: 1200px; 
        margin: 20px auto; 
        padding: 0 20px;
        gap: 15px; 
        display: flex;
        align-items: stretch;
        overflow: visible;
    }
    
    .left-content { 
        flex: 3; 
        min-width: 0; 
        background: #fff; 
        border-radius: 8px; 
        display: flex; 
        flex-direction: column; 
        overflow: hidden;
        height: fit-content;
    }
    
    .player-wrapper { 
        width: 100%;
        display: flex; 
        flex-direction: column;
        flex: none;
    }
    
    .player-section { 
        width: 100%; 
        aspect-ratio: 16/9; 
        background: #000; 
        position: relative; 
        flex-shrink: 0; 
    }
    
    .right-content { 
        flex: 1; 
        min-width: 0;
        background: #f4f4f7; 
        border-radius: 8px; 
        position: relative; 
        min-height: 500px;
        overflow: hidden;
    }
    
    .chat-container {
        position: absolute;
        top: 0; left: 0; right: 0; bottom: 0;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        background: #fff; 
    }
    
    .chat-messages {
        flex: 1;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        min-height: 0;
    }

    /* PC端 match-info-bar 字体加大 */
    .match-info-bar {
        height: 60px; 
    }
    .info-team {
        font-size: 1.15rem; 
        gap: 12px;
    }
    .info-team .team-logo {
        display: flex;
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
    .info-label {
        font-size: 0.75rem;
        padding: 2px 6px;
    }
    .info-score .score {
        font-size: 1.8rem; 
    }
    .info-score .vs {
        font-size: 1.2rem; 
    }
    .info-score {
        width: 150px; 
    }
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
