/* 全局变量 - 默认使用森林绿主题 */
:root {
    /* 森林绿主题 */
    --primary-color: #1c3030;
    --secondary-color: #819c55;
    --bg-color: #f5f9f0;
    --text-color: #333;
    --card-bg: #ffffff;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --timer-bg: #e8f0db;
    --break-color: #a8b780;
    --progress-bg: rgba(129, 156, 85, 0.2);
    --button-hover: rgba(129, 156, 85, 0.2);
    --modal-bg: rgba(0, 0, 0, 0.5);
    
    /* 通用布局变量 */
    --border-radius: 12px;
    --panel-padding: 24px;
    --transition-speed: 0.3s;
}

/* 主题类 - 落日橙 */
.theme-sunset {
    --primary-color: #F26B46;
    --secondary-color: #A8AA91;
    --bg-color: #fff9f5;
    --timer-bg: #ffeee6;
    --break-color: #ffbb9a;
    --progress-bg: rgba(242, 107, 70, 0.2);
    --button-hover: rgba(242, 107, 70, 0.2);
}

/* 主题类 - 深海蓝 */
.theme-ocean {
    --primary-color: #081f5c;
    --secondary-color: #BAD6EB;
    --bg-color: #f5f8ff;
    --timer-bg: #e6f0fa;
    --break-color: #90c2e7;
    --progress-bg: rgba(186, 214, 235, 0.3);
    --button-hover: rgba(186, 214, 235, 0.4);
}

/* 主题类 - 暮光紫 */
.theme-purple {
    --primary-color: #9c5dac;
    --secondary-color: #413e53;
    --bg-color: #f9f5ff;
    --timer-bg: #f0e6fa;
    --break-color: #c69cd1;
    --progress-bg: rgba(156, 93, 172, 0.2);
    --button-hover: rgba(156, 93, 172, 0.2);
}

/* 深色模式 */
.dark-mode {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2c2c2c;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --timer-bg: #333333;
}

/* 森林绿-深色模式 */
.dark-mode.theme-forest {
    --primary-color: #4a7070;
    --secondary-color: #a2c771;
    --timer-bg: rgba(40, 60, 60, 0.95);
    --progress-bg: rgba(162, 199, 113, 0.25);
    --button-hover: rgba(162, 199, 113, 0.3);
}

/* 落日橙-深色模式 */
.dark-mode.theme-sunset {
    --primary-color: #ff7b58;
    --secondary-color: #d8dac0;
    --timer-bg: rgba(100, 40, 30, 0.95);
    --progress-bg: rgba(255, 123, 88, 0.25);
    --button-hover: rgba(255, 123, 88, 0.3);
}

/* 深海蓝-深色模式 */
.dark-mode.theme-ocean {
    --primary-color: #2e58a8;
    --secondary-color: #e1f0f9;
    --timer-bg: rgba(15, 38, 98, 0.95);
    --progress-bg: rgba(186, 214, 235, 0.25);
    --button-hover: rgba(186, 214, 235, 0.3);
}

/* 暮光紫-深色模式 */
.dark-mode.theme-purple {
    --primary-color: #b67cc0;
    --secondary-color: #7a7690;
    --timer-bg: rgba(70, 40, 76, 0.95);
    --progress-bg: rgba(182, 124, 192, 0.25);
    --button-hover: rgba(182, 124, 192, 0.25);
}

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    min-height: 100vh;
    transition: background-color var(--transition-speed), color var(--transition-speed);
}

/* 主容器布局 */
.app-container {
    display: flex;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    gap: 24px;
    min-height: 100vh;
    flex-direction: row;
}

/* 响应式布局 */
@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }
    
    /* 移动设备上调整任务面板高度 */
    .tasks-panel {
        max-height: 600px;
    }
    
    /* 确保图表不会太高 */
    .chart-container {
        height: 150px !important;
    }
    
    /* 确保任务列表不会太高 */
    .task-list {
        max-height: 200px;
    }
}

/* 面板共享样式 */
.tasks-panel, .timer-panel {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: var(--panel-padding);
    box-shadow: 0 6px 16px var(--shadow-color);
    transition: all var(--transition-speed);
    display: flex;
    flex-direction: column;
}

/* 调整面板比例 */
.timer-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.tasks-panel {
    flex: 2;
}

/* 增强番茄钟的视觉效果 */
@media (min-width: 769px) {
    .timer-circle {
        width: 320px;
        height: 320px;
        margin: 30px auto;
    }
    
    #time-left {
        font-size: 56px;
    }
    
    .current-task {
        font-size: 16px;
        max-width: 260px;
    }
    
    .timer-controls {
        gap: 20px;
    }
    
    .control-btn {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
    
    #finish-btn {
        padding: 0 22px;
        font-size: 18px;
    }
}

/* 标题样式 */
h2, h3 {
    color: var(--primary-color);
    margin-bottom: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* === 任务管理面板样式 === */
/* 任务输入容器 */
.task-input-container {
    display: flex;
    margin-bottom: 16px;
}

#task-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #e0e0e0;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
    font-size: 16px;
    outline: none;
    transition: border-color var(--transition-speed);
}

#task-input:focus {
    border-color: var(--primary-color);
}

#save-task-btn {
    padding: 12px 16px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-speed);
}

#save-task-btn:hover {
    background-color: var(--secondary-color);
}

/* 任务列表样式 */
.task-list {
    list-style: none;
    margin-bottom: 24px;
    max-height: 300px;
    overflow-y: auto;
}

.task-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: var(--timer-bg);
    border-radius: var(--border-radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: transform 0.2s, background-color 0.2s;
}

.task-item:hover {
    transform: translateY(-2px);
    background-color: var(--button-hover);
}

.task-item.active {
    border-left: 4px solid var(--primary-color);
}

.task-item.completed {
    opacity: 0.7;
    text-decoration: line-through;
}

.task-checkbox {
    margin-right: 12px;
    width: 20px;
    height: 20px;
    border: 2px solid var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.task-checkbox.checked {
    background-color: var(--primary-color);
    color: white;
}

.task-text {
    flex: 1;
}

.task-delete {
    opacity: 0;
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 16px;
    transition: opacity 0.2s, color 0.2s;
}

.task-item:hover .task-delete {
    opacity: 1;
}

.task-delete:hover {
    color: #e74c3c;
}

/* 统计部分样式 */
.stats-section {
    margin-bottom: 24px;
}

.daily-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.stat-item {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 16px;
    background-color: var(--timer-bg);
    border-radius: var(--border-radius);
}

.stat-icon {
    width: 40px;
    height: 40px;
    background-color: var(--primary-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    margin-right: 12px;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.8;
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.progress-container {
    margin-top: 16px;
}

.progress-label {
    font-size: 14px;
    margin-bottom: 8px;
}

.progress-bar-container {
    height: 8px;
    background-color: var(--progress-bg);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    width: 0; /* 默认值，会通过JS动态更新 */
    transition: width 0.5s;
}

/* 周统计图表 */
.weekly-chart {
    margin-top: auto;
}

.chart-container {
    height: 200px;
    background-color: var(--timer-bg);
    border-radius: var(--border-radius);
    padding: 16px;
}

/* === 番茄钟计时器样式 === */
.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 24px;
}

/* 模式切换按钮 */
.mode-switcher {
    display: flex;
    margin-bottom: 24px;
    width: 100%;
    max-width: 300px;
    border-radius: var(--border-radius);
    overflow: hidden;
}

.mode-btn {
    flex: 1;
    padding: 12px;
    background-color: var(--timer-bg);
    border: none;
    color: var(--text-color);
    font-weight: 500;
    cursor: pointer;
    transition: background-color var(--transition-speed);
}

.mode-btn.active {
    background-color: var(--primary-color);
    color: white;
}

/* 计时器圆环 */
.timer-circle {
    position: relative;
    width: 280px;
    height: 280px;
    margin: 20px 0;
}

.timer-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.timer-background {
    fill: none;
    stroke: var(--timer-bg);
    stroke-width: 5;
}

.timer-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 283; /* 默认值，会通过JS动态更新 */
    transition: stroke-dashoffset 1s linear;
}

.timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

#time-left {
    font-size: 48px;
    font-weight: 600;
    color: var(--primary-color);
}

.current-task {
    font-size: 14px;
    color: var(--text-color);
    opacity: 0.8;
    margin-top: 8px;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 控制按钮 */
.timer-controls {
    display: flex;
    gap: 16px;
    margin-top: 24px;
}

.control-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background-color: var(--primary-color);
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-speed), transform 0.2s;
}

.control-btn:hover {
    background-color: var(--secondary-color);
    transform: scale(1.05);
}

#finish-btn {
    width: auto;
    border-radius: var(--border-radius);
    padding: 0 16px;
    font-size: 16px;
}

.hidden {
    display: none;
}

.cycle-counter {
    margin-top: 16px;
    font-size: 16px;
    color: var(--primary-color);
}

/* 设置面板 */
.settings-section {
    margin-bottom: 24px;
}

.settings-panel {
    background-color: var(--timer-bg);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-top: 8px;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.setting-item label {
    flex: 1;
    font-size: 14px;
}

.setting-item input[type="number"] {
    width: 60px;
    padding: 8px;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    text-align: center;
}

/* 开关样式 */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
}

input:checked + .slider {
    background-color: var(--primary-color);
}

input:focus + .slider {
    box-shadow: 0 0 1px var(--primary-color);
}

input:checked + .slider:before {
    transform: translateX(18px);
}

.slider.round {
    border-radius: 24px;
}

.slider.round:before {
    border-radius: 50%;
}

/* 主题选择器 */
.theme-section {
    margin-top: auto;
}

.theme-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.theme-btn {
    min-width: 80px;
    padding: 10px;
    border: 2px solid transparent;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all var(--transition-speed);
    background-color: var(--timer-bg);
    color: var(--text-color);
}

.theme-btn[data-theme="forest"] {
    background-color: #1c3030;
    color: #819c55;
}

.theme-btn[data-theme="sunset"] {
    background-color: #F26B46;
    color: white;
}

.theme-btn[data-theme="ocean"] {
    background-color: #081f5c;
    color: #BAD6EB;
}

.theme-btn[data-theme="purple"] {
    background-color: #9c5dac;
    color: white;
}

.theme-btn.active {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

#dark-mode-toggle {
    background-color: var(--text-color);
    color: var(--bg-color);
}

/* 图标按钮 */
.icon-btn {
    background: none;
    border: none;
    color: var(--primary-color);
    cursor: pointer;
    font-size: 18px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.icon-btn:hover {
    background-color: var(--button-hover);
}

/* 成就勋章弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 100;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: var(--modal-bg);
}

.modal-content {
    background-color: var(--card-bg);
    margin: 15% auto;
    padding: 24px;
    border-radius: var(--border-radius);
    width: 80%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
    animation: modalFadeIn 0.3s;
}

@keyframes modalFadeIn {
    from {opacity: 0; transform: translateY(-20px);}
    to {opacity: 1; transform: translateY(0);}
}

.achievement-icon {
    font-size: 60px;
    margin-bottom: 16px;
}

#share-achievement-btn, #close-achievement-btn {
    padding: 12px 20px;
    margin-top: 20px;
    margin-right: 8px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 500;
    transition: background-color var(--transition-speed);
}

#share-achievement-btn {
    background-color: var(--primary-color);
    color: white;
}

#close-achievement-btn {
    background-color: var(--timer-bg);
    color: var(--text-color);
}

#share-achievement-btn:hover {
    background-color: var(--secondary-color);
}

#close-achievement-btn:hover {
    background-color: var(--button-hover);
}

/* 粒子礼花特效容器 */
#confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
} 