
/* eye_relax_assistant/frontend/style.css */
/* 基本样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: background-color 0.5s ease;
    overflow-x: hidden;
}

/* 粒子背景 */
#particles-js {
    width: 100%;
    height: 100%;
}

/* 排行榜按钮样式 */
#leaderboard-btn {
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.16);
}

#leaderboard-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

/* 排行榜模态框样式 */
#leaderboard-modal {
    backdrop-filter: blur(5px);
    transition: opacity 0.3s ease;
}

#leaderboard-modal .animate-appear {
    animation: modalAppear 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* 排行榜表格样式 */
#leaderboard-body tr:nth-child(even) {
    background-color: #f8fafc;
}

#leaderboard-body tr:hover {
    background-color: #f1f5f9;
}

#leaderboard-body td {
    padding: 12px 24px;
    font-size: 0.875rem;
    color: #4a5568;
}

#leaderboard-body th {
    padding: 12px 24px;
    font-weight: 600;
    letter-spacing: 0.05em;
}

/* 排行榜关闭按钮 */
#close-leaderboard-modal {
    transition: all 0.2s ease;
}

#close-leaderboard-modal:hover {
    transform: rotate(90deg);
}

/* 排行榜加载状态 */
#leaderboard-body tr.loading td {
    color: #a0aec0;
    font-style: italic;
    text-align: center;
    padding: 24px;
}

/* 排行榜数据更新提示 */
#leaderboard-modal .update-info {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 16px;
    text-align: center;
}

/* 排行榜排名样式 */
#leaderboard-body tr:first-child td:first-child {
    color: #d69e2e;
    font-weight: 700;
}

#leaderboard-body tr:nth-child(2) td:first-child {
    color: #a0aec0;
    font-weight: 600;
}

#leaderboard-body tr:nth-child(3) td:first-child {
    color: #a1887f;
    font-weight: 600;
}

/* 响应式适配 */
@media (max-width: 768px) {
    #leaderboard-modal .bg-white {
        width: 90%;
        padding: 1.5rem;
    }
    
    #leaderboard-body td, 
    #leaderboard-body th {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* 动画定义 */
@keyframes modalAppear {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* 运动区域样式 */
#exercise-area {
    width: 100%;
    height: 60vh;
    min-height: 300px;
    max-height: 500px;
    overflow: hidden;
    background-image: linear-gradient(120deg, #e0f7e0 0%, #c8f5c8 100%);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.5s ease;
}

/* 小球样式 */
#ball {
    width: 30px;
    height: 30px;
    background-image: radial-gradient(circle, #4facfe 0%, #00f2fe 100%);
    box-shadow: 0 0 15px rgba(0, 100, 255, 0.6);
    transform-origin: center center;
    transition: background-color 0.3s ease;
    filter: blur(0.3px);
}

/* 小球光影效果 */
#ball::after {
    content: '';
    position: absolute;
    top: 20%;
    left: 20%;
    width: 30%;
    height: 30%;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.6);
}

/* 小球运动轨迹效果 */
#ball.trail {
    animation: pulse 1s infinite alternate;
}

@keyframes pulse {
    from {
        box-shadow: 0 0 15px rgba(0, 100, 255, 0.6);
    }
    to {
        box-shadow: 0 0 25px rgba(0, 100, 255, 0.8);
    }
}

/* 倒计时动画 */
.countdown-timer {
    animation: countdownPulse 1s infinite alternate;
}

@keyframes countdownPulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }
    100% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* 进度条动画 */
#countdown-progress {
    transition: width 1s linear;
}

/* 基础动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* 屏幕切换动画 */
.screen-transition {
    animation: screenTransition 0.5s ease-in-out;
}

@keyframes screenTransition {
    0% {
        opacity: 0;
        transform: scale(0.95);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* 不同运动轨迹的小球样式 */
#ball.linear {
    background-image: radial-gradient(circle, #4facfe 0%, #00f2fe 100%);
}

#ball.circular {
    background-image: radial-gradient(circle, #7f7fd5 0%, #91eae4 100%);
}

#ball.infinity {
    background-image: radial-gradient(circle, #a770ef 0%, #cf8bf3 100%);
}

#ball.cross {
    background-image: radial-gradient(circle, #ff6b6b 0%, #ff8e8e 100%);
    animation: crossPulse 1.5s infinite alternate;
}

@keyframes crossPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(255, 0, 0, 0.6);
    }
    100% {
        transform: scale(1.1);
        box-shadow: 0 0 25px rgba(255, 0, 0, 0.8);
    }
}

/* 模式按钮选中状态 */
button.active {
    background-color: #1a6b3c !important;
    transform: scale(1.05);
    font-weight: bold;
}

#pattern-linear, #pattern-circular, #pattern-infinity, #pattern-cross {
    background-color: #8fd3a0;
}

#pattern-linear:hover, #pattern-circular:hover, #pattern-infinity:hover, #pattern-cross:hover {
    background-color: #5cb87a;
}

/* 设置面板样式 */
#settings-panel, #stats-panel {
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 滑块样式 */
input[type=range] {
    -webkit-appearance: none;
    height: 8px;
    border-radius: 5px;
    background: #d3d3d3;
    outline: none;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #4facfe;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type=range]::-webkit-slider-thumb:hover {
    transform: scale(1.1);
    background: #007bff;
}

/* 速度调节滑条容器 */
.speed-control-container {
    margin-top: 1.5rem;
    padding: 0 0.5rem;
}

.speed-control-container label {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    color: #4a5568;
    font-size: 0.875rem;
    font-weight: 600;
}

.speed-control-container .speed-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #718096;
}

/* 完成界面动画 */
#completion-screen .fas {
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* 登录模态框样式 */
#login-modal {
    backdrop-filter: blur(4px);
}

#login-modal .animate-appear {
    animation: modalAppear 0.3s ease-out;
}

@keyframes modalAppear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* 表单输入框焦点效果 */
#login-form input:focus, #register-form input:focus {
    box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.5);
    border-color: #4299e1;
}

/* 登录/注册表单切换动画 */
#login-form, #register-form {
    transition: all 0.3s ease-in-out;
}

#login-form.hide, #register-form.hide {
    opacity: 0;
    transform: translateX(-10px);
}

#login-form.show, #register-form.show {
    opacity: 1;
    transform: translateX(0);
}

/* 错误消息动画 */
#login-error, #register-error, #register-success {
    animation: fadeInShake 0.5s ease-out;
}

@keyframes fadeInShake {
    0% {
        opacity: 0;
        transform: translateX(-5px);
    }
    20% {
        transform: translateX(5px);
    }
    40% {
        transform: translateX(-5px);
    }
    60% {
        transform: translateX(5px);
    }
    80% {
        transform: translateX(-5px);
    }
    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* 操作控制按钮区域样式调整 */
.control-section {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* 用户状态信息展示 */
#user-status, #exercise-result-logged {
    animation: fadeIn 0.5s ease-out;
}

/* 响应式适配 */
@media (max-width: 640px) {
    #exercise-area {
        height: 50vh;
        min-height: 250px;
    }
    
    #ball {
        width: 25px;
        height: 25px;
    }
    
    .countdown-timer {
        font-size: 2rem !important;
    }
    
    h1 {
        font-size: 1.75rem !important;
    }
    
    h2 {
        font-size: 1.5rem !important;
    }
    
    .speed-control-container {
        margin-top: 1rem;
    }
    
    /* 移动端登录表单适配 */
    #login-modal .bg-white {
        width: 95%;
        max-width: 400px;
        padding: 1rem;
    }
    
    /* 缩小按钮尺寸 */
    #pause-btn, #exercise-login-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}
