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

body {
    font-family: 'Microsoft YaHei', Arial, sans-serif;
    background-color: #F5F7FA;
    color: #64748B;
    line-height: 1.6;
}

/* 容器样式 */
.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
    background-color: #F5F7FA;
    min-height: 100vh;
}

/* 头部样式 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background-color: #165DFF;
    border-radius: 12px;
    margin-bottom: 20px;
}

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #FFFFFF;
}

.nav {
    display: flex;
    gap: 20px;
    flex-wrap: nowrap;
    overflow: visible;
}

.nav-item {
    text-decoration: none;
    color: #FFFFFF;
    font-size: 16px;
    padding: 8px 16px;
    border-radius: 8px;
    transition: all 0.3s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-item:hover,
.nav-item.active {
    color: #165DFF;
    background-color: #FFFFFF;
}

.user-area {
    display: flex;
    gap: 15px;
}

.login-btn,
.register-btn {
    padding: 8px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.login-btn {
    background-color: #fff;
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
}

.register-btn {
    background-color: #ff6b6b;
    color: #fff;
}

.login-btn:hover {
    background-color: #f0f0f0;
}

.register-btn:hover {
    background-color: #ff5252;
}

/* 主要内容区域 */
.main {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 0;
}

/* 直播列表样式 */
.live-list {
    background-color: #FFFFFF;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(22, 93, 255, 0.1);
}

.section-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 20px;
    color: #1E293B;
}

.live-items {
    display: flex;
    gap: 20px;
    overflow-x: auto;
    padding-bottom: 10px;
    scroll-behavior: smooth;
}

.live-items::-webkit-scrollbar {
    height: 8px;
}

.live-items::-webkit-scrollbar-track {
    background: #F5F7FA;
    border-radius: 4px;
}

.live-items::-webkit-scrollbar-thumb {
    background: #165DFF;
    border-radius: 4px;
}

.live-item {
    background-color: #FFFFFF;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(22, 93, 255, 0.1);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    width: 280px;
    border: 1px solid #E5E7EB;
}

.live-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(22, 93, 255, 0.2);
    border-color: #165DFF;
}

.live-item-img {
    width: 100%;
    height: 160px;
    object-fit: cover;
    position: relative;
}

.live-status {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #165DFF;
    color: #FFFFFF;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: bold;
}

.live-info {
    padding: 15px;
}

.live-title {
    font-size: 14px;
    font-weight: bold;
    margin-bottom: 8px;
    color: #1E293B;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.live-host {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.host-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.host-name {
    font-size: 12px;
    color: #64748B;
}

.live-stats {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #64748B;
}

.view-count {
    display: flex;
    align-items: center;
    gap: 5px;
}

/* 直播列表滚动样式 */
.live-list-scrollable {
    position: relative;
}

/* 直播列表分页样式 */
.live-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    margin-top: 10px;
    border-top: 1px solid #E5E7EB;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #165DFF;
    background-color: #FFFFFF;
    color: #165DFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
    font-size: 16px;
}

.pagination-btn:hover {
    background-color: #165DFF;
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(22, 93, 255, 0.3);
}

.pagination-btn:active {
    transform: translateY(0);
}

.pagination-info {
    font-size: 14px;
    color: #64748B;
    font-weight: bold;
}

.pagination-icon {
    font-size: 12px;
    font-weight: bold;
}

/* 初始显示所有直播项，横向滚动 */
.live-item {
    display: block;
}

/* 礼物列表样式 */
.no-gifts {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 150px;
    color: #64748B;
    font-size: 14px;
    background-color: #FFFFFF;
    border-radius: 12px;
    border: 1px solid #E5E7EB;
}

.gift-error {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 150px;
    color: #165DFF;
    font-size: 14px;
    background-color: #FFFFFF;
    border-radius: 12px;
    padding: 20px;
    text-align: center;
    border: 1px solid #E5E7EB;
}

.gift-error h3 {
    margin-bottom: 10px;
    font-size: 16px;
    color: #1E293B;
}

.gift-error p {
    margin-bottom: 15px;
    color: #64748B;
}

.gift-error .retry-btn {
    padding: 8px 20px;
    background-color: #165DFF;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.gift-error .retry-btn:hover {
    background-color: #0EA5E9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

/* 直播详情样式 */
.live-detail {
    background-color: #FFFFFF;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(22, 93, 255, 0.1);
    min-height: 500px;
}

.placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #64748B;
}

.placeholder h3 {
    margin-bottom: 10px;
    color: #1E293B;
}

/* 播放器容器样式 */
.player-container {
    margin-bottom: 20px;
    background-color: #000;
    border-radius: 12px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.15);
}

#player {
    width: 100%;
    height: 500px;
}

/* 播放器加载状态样式 */
.player-loading,
.player-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: #fff;
    background-color: rgba(0, 0, 0, 0.8);
    text-align: center;
    padding: 20px;
}

.player-loading h3,
.player-error h3 {
    margin-bottom: 10px;
    font-size: 18px;
    color: #fff;
}

.player-loading p,
.player-error p {
    font-size: 14px;
    color: #ccc;
}

/* 加载动画 */
.loading-spinner {
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #165DFF;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin-bottom: 15px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 直播信息样式 */
.live-info-section {
    background-color: #FFFFFF;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 2px 8px rgba(22, 93, 255, 0.1);
}

.live-detail-title {
    font-size: 24px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #1E293B;
}

.live-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #E5E7EB;
}

.host-detail {
    display: flex;
    align-items: center;
    gap: 15px;
}

.host-detail .host-avatar {
    width: 48px;
    height: 48px;
}

.host-detail .host-name {
    font-size: 16px;
    font-weight: bold;
    color: #1E293B;
}

.follow-btn {
    padding: 10px 24px;
    background-color: #165DFF;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.follow-btn:hover {
    background-color: #0EA5E9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

.follow-btn.following {
    background-color: #64748B;
}

.live-description {
    font-size: 14px;
    color: #64748B;
    line-height: 1.6;
}

/* 互动区域样式 */
.interaction-area {
    background-color: #FFFFFF;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(22, 93, 255, 0.1);
}

.barrage-section {
    margin-bottom: 20px;
}

.barrage-input-container {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

#barrageInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    color: #1E293B;
    transition: all 0.3s ease;
}

#barrageInput:focus {
    outline: none;
    border-color: #165DFF;
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
}

.send-btn {
    padding: 12px 24px;
    background-color: #165DFF;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.send-btn:hover {
    background-color: #0EA5E9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

/* 礼物区域样式 */
.gift-section {
    margin-top: 20px;
}

.gift-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 10px;
}

.gift-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: #FFFFFF;
}

.gift-item:hover {
    border-color: #165DFF;
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.2);
}

.gift-icon {
    width: 48px;
    height: 48px;
    object-fit: cover;
    margin-bottom: 8px;
}

.gift-name {
    font-size: 12px;
    color: #1E293B;
    margin-bottom: 4px;
    font-weight: 500;
}

.gift-price {
    font-size: 12px;
    color: #165DFF;
    font-weight: bold;
}

/* 页脚样式 */
.footer {
    text-align: center;
    padding: 20px;
    border-top: 1px solid #E5E7EB;
    color: #64748B;
    font-size: 14px;
    background-color: #FFFFFF;
    border-radius: 12px;
    margin-top: 20px;
}

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

.modal-content {
    background-color: #FFFFFF;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #E5E7EB;
    width: 80%;
    max-width: 1000px;
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(22, 93, 255, 0.2);
    position: relative;
}

.close {
    color: #64748B;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 20px;
    top: 10px;
    transition: color 0.3s ease;
}

.close:hover,
.close:focus {
    color: #165DFF;
    text-decoration: none;
    cursor: pointer;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .main {
        flex-direction: column;
    }

    .live-items {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .user-area {
        width: 100%;
        justify-content: center;
    }

    #player {
        height: 300px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .live-list,
    .live-detail {
        padding: 15px;
    }

    .live-items {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 10px;
    }

    .live-item-img {
        height: 80px;
    }

    .live-info {
        padding: 10px;
    }

    #player {
        height: 200px;
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(22, 93, 255, 0.3);
    border-radius: 50%;
    border-top-color: #165DFF;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 加载容器样式 */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: #666;
}

.loading-container .loading {
    margin-bottom: 10px;
    width: 30px;
    height: 30px;
}

.loading-container p {
    margin: 0;
    font-size: 16px;
}

/* 错误容器样式 */
.error-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
    color: #165DFF;
    background-color: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    margin: 20px 0;
}

.error-container p {
    margin: 0 0 20px 0;
    font-size: 16px;
    color: #64748B;
}

.retry-btn {
    padding: 10px 24px;
    background-color: #165DFF;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: bold;
}

.retry-btn:hover {
    background-color: #0EA5E9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

/* 弹幕样式 */
.barrage {
    position: absolute;
    font-size: 16px;
    font-weight: bold;
    white-space: nowrap;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 10;
    animation: barrage-animation 8s linear forwards;
}

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

/* 认证模态框样式 */
.auth-modal {
    max-width: 500px;
    width: 90%;
    margin: 10% auto;
}

.auth-modal h2 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 24px;
}

#loginForm, #registerForm {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-size: 14px;
    color: #64748B;
    font-weight: bold;
}

.form-group input {
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    font-size: 14px;
    transition: all 0.3s ease;
    color: #1E293B;
}

.form-group input:focus {
    outline: none;
    border-color: #165DFF;
    box-shadow: 0 0 0 3px rgba(22, 93, 255, 0.1);
}

.form-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}

.submit-btn {
    padding: 12px 24px;
    background-color: #165DFF;
    color: #FFFFFF;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.submit-btn:hover {
    background-color: #0EA5E9;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(22, 93, 255, 0.3);
}

.switch-mode {
    text-align: center;
    font-size: 14px;
    color: #64748B;
    margin: 0;
}

.switch-mode a {
    color: #165DFF;
    text-decoration: none;
    font-weight: bold;
    transition: color 0.3s ease;
}

.switch-mode a:hover {
    color: #0EA5E9;
}

/* APP下载提示模态框样式 */
.app-download-content {
    width: auto;
    max-width: 450px;
    text-align: center;
    background-color: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(22, 93, 255, 0.2);
    padding: 20px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid #E5E7EB;
}

.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.qr-code {
    width: 400px;
    height: 400px;
    object-fit: cover;
    border: 2px solid #165DFF;
    border-radius: 12px;
}

.qr-text {
    font-size: 18px;
    font-weight: bold;
    color: #1E293B;
    text-align: center;
    line-height: 1.5;
}

/* 确保模态框居中显示 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.5);
}