/* 番茄时钟 - 高级优化版样式 */

/* 基础重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-attachment: fixed;
    background-size: cover;
    color: #111827;
    line-height: 1.5;
    min-height: 100vh;
    position: relative;
}

/* 添加背景图片覆盖层 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('imgs/main_background_5.jpg');
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    opacity: 0.15;
    z-index: -2;
}

/* 渐变遮罩层 */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    z-index: -1;
}

/* 容器 */
.app-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 16px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 1;
}

/* 头部 */
.app-header {
    text-align: center;
    margin-bottom: 48px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 8px;
    color: #FFFFFF;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.app-header p {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

/* 模式切换器 */
.mode-switcher {
    display: flex;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50px;
    padding: 4px;
    margin-bottom: 48px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.mode-btn {
    padding: 12px 24px;
    border: none;
    background: transparent;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    transition: all 250ms ease-in-out;
    white-space: nowrap;
    position: relative;
}

.mode-btn.active {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.mode-btn:hover:not(.active) {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.1);
}

/* 计时器面板 */
.timer-panel {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 64px;
}

.timer-container {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 24px;
    padding: 48px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 520px;
    position: relative;
}

/* 进度条容器 */
.progress-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 48px;
}

/* 调整环形进度条尺寸，避免重叠 */
.progress-ring {
    transform: rotate(-90deg);
    width: 280px;
    height: 280px;
}

.progress-ring-track {
    fill: none;
    stroke: rgba(255, 255, 255, 0.2);
    stroke-width: 8;
}

.progress-ring-progress {
    fill: none;
    stroke: #FFFFFF;
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 659.734457; /* 2 * π * 105 (调整半径) */
    stroke-dashoffset: 659.734457;
    transition: stroke-dashoffset 1s ease-in-out;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.3));
}

/* 计时器显示 */
.timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 2;
}

.time-text {
    font-size: 72px;
    font-weight: 700;
    line-height: 1;
    color: #FFFFFF;
    margin-bottom: 8px;
    font-family: 'Courier New', monospace;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    letter-spacing: 2px;
}

.status-text {
    font-size: 16px;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* 控制按钮 */
.control-buttons {
    display: flex;
    justify-content: center;
    gap: 24px;
    align-items: center;
}

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 16px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 300ms cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    opacity: 0;
    transition: opacity 300ms ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn-primary {
    width: 160px;
    height: 56px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #FFFFFF;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #FFFFFF;
    transform: translateY(-1px);
}

.btn-secondary .icon {
    width: 24px;
    height: 24px;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

/* 统计区域 */
.stats-section {
    width: 100%;
    margin-bottom: 48px;
}

.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.stat-item {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 32px 24px;
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    text-align: center;
    transition: transform 300ms ease, box-shadow 300ms ease;
}

.stat-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.stat-number {
    font-size: 32px;
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

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

/* 设置面板 */
.settings-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.settings-overlay.active {
    display: flex;
}

.settings-panel {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 400ms cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 32px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.settings-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #1F2937;
}

.close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #6B7280;
    padding: 8px;
    border-radius: 12px;
    transition: all 200ms ease;
}

.close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: #1F2937;
}

.settings-content {
    padding: 32px;
}

.setting-group {
    margin-bottom: 48px;
}

.setting-group:last-child {
    margin-bottom: 0;
}

.setting-group h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 24px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    font-size: 16px;
    color: #374151;
    font-weight: 500;
}

.setting-item input[type="number"],
.setting-item select {
    padding: 12px 16px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    font-size: 16px;
    font-family: inherit;
    background: rgba(255, 255, 255, 0.8);
    color: #1F2937;
    width: 100px;
    transition: all 200ms ease;
    backdrop-filter: blur(10px);
}

.setting-item input[type="number"]:focus,
.setting-item select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    background: rgba(255, 255, 255, 0.95);
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #667eea;
}

.settings-footer {
    display: flex;
    justify-content: space-between;
    padding: 32px;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    gap: 16px;
}

.settings-footer .btn {
    flex: 1;
    height: 48px;
}

.settings-footer .btn-secondary {
    background: rgba(0, 0, 0, 0.05);
    color: #374151;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.settings-footer .btn-secondary:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .app-container {
        padding: 24px 16px;
    }
    
    .app-header {
        padding: 24px;
        margin-bottom: 32px;
    }
    
    .app-header h1 {
        font-size: 28px;
    }
    
    .timer-container {
        padding: 32px 24px;
    }
    
    .progress-ring {
        width: 220px;
        height: 220px;
    }
    
    .progress-ring-track,
    .progress-ring-progress {
        stroke-width: 6;
    }
    
    .time-text {
        font-size: 56px;
    }
    
    .control-buttons {
        flex-direction: column;
        gap: 16px;
    }
    
    .btn-primary {
        width: 140px;
    }
    
    .stats-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-item {
        padding: 24px 20px;
    }
    
    .settings-panel {
        width: 95%;
        margin: 16px;
    }
    
    .setting-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .setting-item input[type="number"],
    .setting-item select {
        width: 100%;
        max-width: 120px;
    }
    
    .settings-footer {
        flex-direction: column;
    }
}

/* 深色主题支持 */
@media (prefers-color-scheme: dark) {
    .settings-panel {
        background: rgba(31, 41, 55, 0.95);
        color: #F9FAFB;
    }
    
    .settings-header h2,
    .setting-group h3,
    .setting-item label {
        color: #F9FAFB;
    }
    
    .setting-item input[type="number"],
    .setting-item select {
        background: rgba(55, 65, 81, 0.8);
        border-color: rgba(75, 85, 99, 0.3);
        color: #F9FAFB;
    }
    
    .settings-header,
    .settings-footer {
        border-color: rgba(75, 85, 99, 0.3);
    }
}

/* 动画优化 */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}