:root {
    --primary-color: #3498db;
    --primary-hover: #2980b9;
    --bg-color: #f0f7ff;
    --card-bg: #ffffff;
    --text-color: #2c3e50;
    --text-muted: #7f8c8d;
    --danger-color: #e74c3c;
    --danger-hover: #c0392b;
    --success-color: #2ecc71;
    --shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    --border-radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.container {
    background-color: var(--card-bg);
    width: 100%;
    max-width: 700px;
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    margin: 20px 0;
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: var(--primary-color);
    font-size: 2rem;
    margin-bottom: 20px;
}

/* 日期選擇器樣式 */
.date-selector {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.date-selector button {
    background: none;
    border: none;
    color: var(--primary-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 50%;
    transition: background-color 0.3s;
}

.date-selector button:hover {
    background-color: #e1f0fa;
}

#current-date-picker {
    padding: 8px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 20px;
    font-size: 1rem;
    color: var(--text-color);
    outline: none;
    cursor: pointer;
}

#current-date-picker:focus {
    border-color: var(--primary-color);
}

.stats {
    display: flex;
    justify-content: space-around;
    font-size: 0.9rem;
    color: var(--text-muted);
    background: #f8fbfe;
    padding: 10px;
    border-radius: 8px;
}

#todo-form {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

#todo-input {
    flex: 1;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius);
    outline: none;
    font-size: 1rem;
    transition: border-color 0.3s, box-shadow 0.3s;
}

#todo-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(52, 152, 219, 0.2);
}

#add-btn {
    padding: 10px 20px;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    gap: 5px;
}

#add-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

#todo-list {
    list-style: none;
    max-height: 400px;
    overflow-y: auto;
    padding-right: 5px;
    margin-bottom: 30px;
}

/* 滾動條樣式 */
#todo-list::-webkit-scrollbar {
    width: 6px;
}
#todo-list::-webkit-scrollbar-thumb {
    background-color: #e0e0e0;
    border-radius: 10px;
}

.todo-item {
    display: flex;
    align-items: center;
    padding: 15px;
    background-color: #fff;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.todo-item:hover {
    background-color: #f9fcff;
}

.todo-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-right: 15px;
    accent-color: var(--primary-color);
}

.todo-text {
    flex: 1;
    font-size: 1rem;
    transition: color 0.3s, text-decoration 0.3s;
    line-height: 1.4;
}

.todo-text.completed {
    text-decoration: line-through;
    color: var(--text-muted);
}

.delete-btn {
    background-color: transparent;
    color: #bdc3c7;
    border: none;
    padding: 5px 10px;
    cursor: pointer;
    border-radius: 6px;
    transition: color 0.3s, background-color 0.3s;
}

.delete-btn:hover {
    color: var(--danger-color);
    background-color: #fff5f5;
}

/* 統計區域樣式（底部） */
.statistics-section {
    padding: 20px;
    background-color: #fdfdfd;
    border-top: 2px solid #f0f7ff;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    margin-top: 20px;
}

.statistics-section h3 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.stats-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

#stats-period {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    outline: none;
    font-size: 0.9rem;
    cursor: pointer;
}

#refresh-stats-btn {
    padding: 8px 12px;
    background-color: #f0f7ff;
    color: var(--primary-color);
    border: 1px solid #d0e7ff;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

#refresh-stats-btn:hover {
    background-color: var(--primary-color);
    color: white;
}

.chart-container {
    width: 100%;
    height: 250px;
    margin-bottom: 20px;
    position: relative;
}

.progress-container {
    width: 100%;
    height: 12px;
    background-color: #f0f0f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar {
    height: 100%;
    background-color: var(--primary-color);
    color: white;
    font-size: 0.7rem;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: width 0.5s ease-in-out;
    width: 0%;
}

#stats-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

/* 響應式設計 */
@media (max-width: 480px) {
    .container {
        padding: 20px;
        margin: 10px 0;
    }
    
    header h1 {
        font-size: 1.5rem;
    }

    .date-selector {
        gap: 5px;
    }

    #current-date-picker {
        padding: 5px 10px;
        font-size: 0.9rem;
    }
    
    #todo-form {
        flex-direction: column;
    }
    
    #add-btn {
        width: 100%;
        justify-content: center;
    }

    .stats-controls {
        flex-direction: column;
    }

    .chart-container {
        height: 200px;
    }
}
