/* 优化样式 - 从index.html内联CSS迁移而来 */

/* 移动端响应式优化 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .glass-container {
        margin: 10px auto;
        padding: 15px;
        width: 95%;
    }
    
    .button-row {
        flex-direction: column;
    }
    
    .glass-button {
        width: 100%;
        margin: 5px 0;
    }
    
    .music-player {
        flex-direction: column;
        align-items: center;
    }
    
    .vinyl-section {
        margin-bottom: 15px;
    }
    
    /* 防止iOS自动缩放 */
    input, textarea, select {
        font-size: 16px !important;
    }
}

/* 防止FOUT/FOIT字体闪烁 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    overflow-y: auto;
    position: relative;
}

/* 页面加载闪烁修复 - 关键样式内联优化 */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    
    /* 移除自动消失动画 - 由JS精确控制显示逻辑 */
    /* animation: fadeOut 0.5s ease 1s forwards; */
    
    /* 强制保持可见性直到JS处理 */
    opacity: 1 !important;
    visibility: visible !important;
}

.loading-spinner {
    text-align: center;
    color: white;
    font-size: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.loading-spinner::before {
    content: '';
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes fadeOut {
    to {
        opacity: 0;
        visibility: hidden;
    }
}

/* 弹窗滚动锁定机制 */
body.modal-open {
    overflow: hidden;
}

/* 移动端背景滚动修复 */
.background {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: -1;
    background-attachment: fixed;
}

/* 动画性能优化 */
.glass-container, .vinyl, .avatar {
    transform: translateZ(0);
    backface-visibility: hidden;
}

.vinyl {
    will-change: transform;
}

/* 滚动性能优化 */
.container {
    contain: content;
}

.glass-container {
    contain: layout style paint;
}

/* 移除移动端点击延迟 */
.glass-button, .control-btn, .tab-btn, .save-btn, .close-btn {
    touch-action: manipulation;
}

/* 减少动画偏好的用户支持 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 滚动性能优化 */
body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    -webkit-overflow-scrolling: touch; /* 启用硬件加速滚动 */
}

/* 针对移动设备进一步优化动画性能 */
@media (max-width: 768px) {
  .contributor-item,
  .sponsor-item {
    transition: background-color 0.2s ease;
    transform: translateZ(0);
    backface-visibility: hidden;
  }
  
  .video-refresh-btn {
    transition: transform 0.2s ease;
  }
  
  .video-close-btn {
    transition: all 0.2s;
  }
}

/* 技术支持 / 赞助名单弹窗常驻隐藏，避免 display 切换导致移动端跳位 */
#techSupportModal,
#sponsorListModal {
    display: flex !important;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
}

#techSupportModal.modal-visible,
#sponsorListModal.modal-visible {
    visibility: visible;
    pointer-events: auto;
}

#techSupportModal.modal-open,
#sponsorListModal.modal-open {
    opacity: 1;
}

/* 技术支持 & 赞助名单样式 */
.contributors-list,
.sponsors-list {
    max-height: 400px;
    overflow-y: auto;
    margin: 20px 0;
    padding-right: 10px;
}

.contributor-item,
.sponsor-item {
    display: flex;
    align-items: center;
    padding: 12px;
    margin-bottom: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.contributor-item:hover,
.sponsor-item:hover {
    background: rgba(0, 0, 0, 0.1);
    transform: translateX(5px);
}

.contributor-avatar,
.sponsor-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
}

.contributor-info,
.sponsor-info {
    flex: 1;
}

.contributor-name,
.sponsor-name {
    font-weight: bold;
    color: #333;
    margin-bottom: 4px;
}

.contributor-role,
.sponsor-amount {
    font-size: 12px;
    color: #666;
}

.contributor-role .date,
.sponsor-amount .date {
    margin-left: 10px;
    color: #999;
}

.contribution-desc,
.sponsor-message {
    font-size: 13px;
    color: #555;
    margin-top: 4px;
}

.sponsor-stats {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    background: linear-gradient(135deg, #4CAF50, #45a049);
    color: white;
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.stat-item i {
    font-size: 24px;
    margin-bottom: 8px;
    display: block;
}

.stat-item span {
    font-size: 14px;
    display: block;
}

.stat-item #totalSponsors,
.stat-item #totalAmount {
    font-size: 18px;
    font-weight: bold;
    margin-top: 5px;
}

.save-btn.secondary {
    background: linear-gradient(45deg, #6c757d, #5a6268);
    margin-left: 10px;
}

.save-btn.secondary:hover {
    background: linear-gradient(45deg, #5a6268, #484e53);
}

/* 视频推荐弹窗样式 */
.video-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s ease;
}

.video-modal-content {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: modalSlideIn 0.4s ease;
}

.video-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.video-modal-header h3 {
    margin: 0;
    font-size: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.video-modal-header h3 i {
    font-size: 24px;
}

.video-close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 28px;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s;
}

.video-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.video-modal-body {
    padding: 0;
    height: calc(85vh - 80px);
    overflow: hidden;
}

.video-iframe-container {
    width: 100%;
    height: 100%;
    position: relative;
}

.video-iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.video-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: #333;
}

.video-loading i {
    font-size: 48px;
    color: #667eea;
    margin-bottom: 20px;
    animation: spin 2s linear infinite;
}

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

.video-info {
    padding: 15px 25px;
    background: rgba(0, 0, 0, 0.03);
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    font-size: 14px;
    color: #666;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.video-refresh-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.video-refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* 动画 */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

@media (max-width: 768px) {
    .video-modal-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .video-modal-header {
        padding: 15px 20px;
    }
    
    .video-modal-header h3 {
        font-size: 18px;
    }
    
    .video-info {
        padding: 12px 20px;
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .video-close-btn {
        font-size: 24px;
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 480px) {
    .video-modal-content {
        width: 100%;
        height: 100vh;
        max-height: 100vh;
        border-radius: 0;
    }
    
    .video-modal-body {
        height: calc(100vh - 140px);
    }
    
    .video-modal-header {
        padding: 12px 15px;
    }
}

@media (max-width: 768px) {
    .sponsor-stats {
        grid-template-columns: 1fr;
    }
    
    .contributor-item,
    .sponsor-item {
        flex-direction: column;
        text-align: center;
    }
    
    .contributor-avatar,
    .sponsor-avatar {
        margin-right: 0;
        margin-bottom: 10px;
    }
}

/* 管理员控制样式 */
.admin-controls {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    padding: 10px 15px;
    border-radius: 8px;
    color: white;
    font-size: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.admin-controls h4 {
    margin: 0 0 8px 0;
    color: #4CAF50;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 5px;
}

.admin-controls button {
    padding: 6px 12px;
    margin: 2px;
    font-size: 11px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-controls button:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* 空状态样式 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #999;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 20px;
    color: #ddd;
}

.empty-state p {
    margin: 5px 0;
}

/* 加载状态 */
.loading-state {
    text-align: center;
    padding: 30px;
    color: #666;
}

.loading-state i {
    font-size: 24px;
    margin-bottom: 10px;
    color: #4CAF50;
    animation: spin 1s linear infinite;
}