/**
 * 后台管理页面样式
 * 独立的管理界面，优化滚动性能
 */

* {
    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, #1a1a2e 0%, #16213e 50%, #0f0f23 100%);
    min-height: 100vh;
    color: #fff;
}

/* ========== 认证弹窗 ========== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.auth-overlay.hidden {
    display: none;
}

.auth-modal {
    background: linear-gradient(145deg, #1e1e3f, #151530);
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    border: 2px solid rgba(255, 215, 0, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 400px;
    width: 90%;
}

.auth-header {
    margin-bottom: 30px;
}

.auth-header h2 {
    color: #ffd700;
    font-size: 28px;
    margin: 15px 0 10px;
}

.auth-header p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

.auth-input {
    width: 100%;
    padding: 15px 20px;
    border: 2px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 16px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}

.auth-input:focus {
    outline: none;
    border-color: #ffd700;
    background: rgba(255, 255, 255, 0.1);
}

.auth-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    border: none;
    border-radius: 12px;
    color: #1a1a2e;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.auth-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 215, 0, 0.3);
}

.auth-error {
    color: #ff4444;
    font-size: 14px;
    margin-top: 15px;
    min-height: 20px;
}

/* ========== 主容器 ========== */
.admin-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== 顶部导航 ========== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 30px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 215, 0, 0.1);
}

.header-left h1 {
    font-size: 28px;
    color: #ffd700;
    margin-bottom: 5px;
}

.header-left .subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

.btn-back {
    padding: 12px 24px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    text-decoration: none;
    border-radius: 10px;
    font-weight: bold;
    transition: all 0.3s ease;
}

.btn-back:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 215, 0, 0.3);
}

/* 背景音乐按钮由 common-bgm.js 提供 */
.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

@keyframes bgmPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(0, 255, 136, 0.3); }
    50% { box-shadow: 0 0 20px rgba(0, 255, 136, 0.6); }
}

/* ========== 统计卡片 ========== */
.stats-section {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 25px;
    display: flex;
    align-items: center;
    gap: 20px;
    border: 1px solid rgba(255, 215, 0, 0.1);
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    border-color: rgba(255, 215, 0, 0.3);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.stat-icon {
    font-size: 40px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-value {
    font-size: 36px;
    font-weight: bold;
    color: #ffd700;
}

.stat-label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
}

/* ========== 功能区域网格 ========== */
.admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 20px;
}

.admin-section {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    border: 1px solid rgba(255, 215, 0, 0.1);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.participants-section {
    grid-row: span 2;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: rgba(255, 215, 0, 0.05);
    border-bottom: 1px solid rgba(255, 215, 0, 0.1);
}

.section-header h2 {
    font-size: 18px;
    color: #ffd700;
}

.section-actions {
    display: flex;
    gap: 10px;
}

.section-content {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 500px;
}

.participants-section .section-content {
    max-height: 600px;
}

.section-footer {
    padding: 15px 20px;
    background: rgba(255, 215, 0, 0.05);
    border-top: 1px solid rgba(255, 215, 0, 0.1);
}

/* ========== 按钮样式 ========== */
.btn-action {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    font-weight: bold;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

.btn-test {
    background: rgba(100, 200, 100, 0.2);
    color: #90EE90;
    border: 1px solid rgba(100, 200, 100, 0.3);
}

.btn-test:hover {
    background: rgba(100, 200, 100, 0.3);
}

.btn-danger {
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(255, 68, 68, 0.3);
}

.btn-export {
    background: rgba(100, 149, 237, 0.2);
    color: #87CEEB;
    border: 1px solid rgba(100, 149, 237, 0.3);
}

.btn-export:hover {
    background: rgba(100, 149, 237, 0.3);
}

/* ========== 参与者列表 ========== */
.participant-list-container {
    border: 1px solid rgba(255, 215, 0, 0.1);
    border-radius: 10px;
    overflow: hidden;
}

.list-header {
    display: grid;
    grid-template-columns: 1fr 1fr 80px 120px;
    gap: 10px;
    padding: 12px 15px;
    background: rgba(255, 215, 0, 0.1);
    font-size: 13px;
    font-weight: bold;
    color: #ffd700;
}

.participant-list {
    max-height: 500px;
    overflow-y: auto;
}

.participant-item {
    display: grid;
    grid-template-columns: 1fr 1fr 80px 120px;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
    transition: background 0.2s ease;
}

.participant-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.participant-item.winner {
    background: rgba(255, 215, 0, 0.1);
}

.participant-name {
    font-weight: 500;
}

.participant-id {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
}

.participant-photo img {
    width: 50px;
    height: 50px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.participant-photo img:hover {
    transform: scale(1.1);
}

.participant-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.winner-badge {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: bold;
}

.btn-delete {
    padding: 6px 12px;
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
    border: 1px solid rgba(255, 68, 68, 0.3);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: rgba(255, 68, 68, 0.4);
}

/* ========== 奖项设置 ========== */
.prize-list {
    margin-bottom: 20px;
}

.prize-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 10px;
    border: 1px solid rgba(255, 215, 0, 0.1);
}

.prize-info {
    display: flex;
    gap: 15px;
    align-items: center;
}

.prize-name {
    font-weight: bold;
    color: #ffd700;
}

.prize-count {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}

.prize-won {
    color: #90EE90;
    font-size: 13px;
}

.btn-delete-prize {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 68, 68, 0.2);
    color: #ff6b6b;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete-prize:hover {
    background: rgba(255, 68, 68, 0.4);
    transform: scale(1.1);
}

.prize-add {
    display: flex;
    gap: 10px;
}

.prize-add input {
    flex: 1;
    padding: 10px 15px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 14px;
}

.prize-add input:focus {
    outline: none;
    border-color: #ffd700;
}

.prize-add input[type="number"] {
    width: 80px;
    flex: none;
}

.btn-add {
    padding: 10px 20px;
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add:hover {
    transform: translateY(-2px);
}

/* ========== 中奖历史 ========== */
.winner-history-list {
    max-height: 300px;
    overflow-y: auto;
}

.winner-history-item {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.winner-history-item:hover {
    background: rgba(255, 255, 255, 0.03);
}

.winner-name {
    font-weight: 500;
}

.winner-prize {
    color: #ffd700;
}

.winner-time {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

/* ========== 系统设置 ========== */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
}

.setting-item label {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.setting-control {
    display: flex;
    align-items: center;
    gap: 15px;
}

.setting-control input[type="range"] {
    width: 200px;
    height: 6px;
    -webkit-appearance: none;
    background: rgba(255, 215, 0, 0.2);
    border-radius: 3px;
    outline: none;
}

.setting-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #ffd700;
    border-radius: 50%;
    cursor: pointer;
}

.setting-value {
    color: #ffd700;
    font-weight: bold;
    min-width: 50px;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: rgba(255, 255, 255, 0.5);
}

/* ========== Toast 通知 ========== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    background: rgba(30, 30, 63, 0.95);
    border-radius: 12px;
    border: 1px solid rgba(255, 215, 0, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: slideIn 0.3s ease;
}

.toast-success {
    border-color: rgba(100, 200, 100, 0.5);
}

.toast-success .toast-icon {
    color: #90EE90;
}

.toast-error {
    border-color: rgba(255, 68, 68, 0.5);
}

.toast-error .toast-icon {
    color: #ff6b6b;
}

.toast-warning {
    border-color: rgba(255, 193, 7, 0.5);
}

.toast-warning .toast-icon {
    color: #ffc107;
}

.toast-info .toast-icon {
    color: #87CEEB;
}

.toast-out {
    animation: slideOut 0.3s ease forwards;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* ========== 确认弹窗 ========== */
.confirm-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.confirm-modal.show {
    opacity: 1;
    visibility: visible;
}

.confirm-content {
    background: linear-gradient(145deg, #1e1e3f, #151530);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    border: 2px solid rgba(255, 215, 0, 0.3);
    max-width: 400px;
    width: 90%;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.confirm-modal.show .confirm-content {
    transform: scale(1);
}

.confirm-icon {
    margin-bottom: 20px;
}

.confirm-message {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    margin-bottom: 25px;
    white-space: pre-line;
}

.confirm-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.confirm-btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.confirm-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}

.confirm-ok {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    color: #1a1a2e;
    font-weight: bold;
}

.confirm-ok:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
}

/* ========== 照片预览 ========== */
.photo-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 4000;
    animation: fadeIn 0.3s ease;
}

.photo-preview-content {
    position: relative;
    max-width: 90%;
    max-height: 90%;
}

.photo-preview-content img {
    max-width: 100%;
    max-height: 80vh;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.btn-close-preview {
    position: absolute;
    top: -15px;
    right: -15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: #ff4444;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-close-preview:hover {
    transform: scale(1.1);
}

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

/* ========== 响应式 ========== */
@media (max-width: 1200px) {
    .admin-grid {
        grid-template-columns: 1fr;
    }

    .participants-section {
        grid-row: auto;
    }

    .stats-section {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .admin-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .stats-section {
        grid-template-columns: 1fr 1fr;
    }

    .section-header {
        flex-direction: column;
        gap: 10px;
    }

    .section-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .list-header,
    .participant-item {
        grid-template-columns: 1fr 1fr;
    }

    .participant-photo,
    .list-header span:nth-child(3) {
        display: none;
    }
}

/* ========== 开关样式 ========== */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch .slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: 0.3s;
    border-radius: 26px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.switch .slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 2px;
    bottom: 2px;
    background-color: rgba(255, 255, 255, 0.6);
    transition: 0.3s;
    border-radius: 50%;
}

.switch input:checked + .slider {
    background: linear-gradient(135deg, #ffd700, #ffaa00);
    border-color: #ffd700;
}

.switch input:checked + .slider:before {
    transform: translateX(24px);
    background-color: #1a1a2e;
}

.setting-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    min-width: 50px;
}
