/* 기본 스타일 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #4a90e2;
    --success-color: #50c878;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --text-dark: #333333;
    --text-light: #666666;
    --background: #f8f9fa;
    --white: #ffffff;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 16px rgba(0, 0, 0, 0.15);
    --border-color: #e0e0e0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans', Helvetica, Arial, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

/* To-Do App */
.todo-app {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

/* 헤더 */
.todo-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    padding: 30px 20px;
    text-align: center;
}

.todo-header h1 {
    font-size: 2rem;
    margin-bottom: 8px;
    font-weight: 700;
}

.todo-header p {
    opacity: 0.9;
    font-size: 0.95rem;
}

/* 입력 섹션 */
.input-section {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.todo-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    font-family: inherit;
}

.todo-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.add-btn {
    padding: 12px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--white);
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.add-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.add-btn:active {
    transform: translateY(0);
}

/* 필터 버튼 */
.filter-buttons {
    display: flex;
    gap: 10px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.filter-btn {
    padding: 8px 16px;
    border: 2px solid var(--border-color);
    background: var(--white);
    color: var(--text-dark);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    font-size: 0.9rem;
}

.filter-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.filter-btn.active {
    background: var(--primary-color);
    color: var(--white);
    border-color: var(--primary-color);
}

/* 통계 */
.stats {
    display: flex;
    gap: 15px;
    padding: 20px;
    background: var(--background);
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.stat-item {
    flex: 1;
    min-width: 100px;
    padding: 10px;
    background: var(--white);
    border-radius: 8px;
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-label {
    display: block;
    color: var(--text-light);
    font-size: 0.85rem;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* 할일 리스트 */
.todo-list {
    padding: 10px;
    max-height: 400px;
    overflow-y: auto;
}

.todo-list::-webkit-scrollbar {
    width: 6px;
}

.todo-list::-webkit-scrollbar-track {
    background: var(--background);
}

.todo-list::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.todo-list::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}

/* 할일 항목 */
.todo-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: var(--white);
    border-radius: 8px;
    margin-bottom: 8px;
    border-left: 4px solid var(--primary-color);
    transition: all 0.3s ease;
    animation: slideIn 0.3s ease;
}

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

.todo-item:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.todo-item.completed {
    background: var(--background);
    border-left-color: var(--success-color);
}

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

/* 체크박스 */
.todo-checkbox {
    width: 24px;
    height: 24px;
    cursor: pointer;
    accent-color: var(--success-color);
    flex-shrink: 0;
}

/* 할일 텍스트 */
.todo-text {
    flex: 1;
    color: var(--text-dark);
    word-break: break-word;
    transition: all 0.3s ease;
    font-size: 0.95rem;
}

/* 액션 버튼 그룹 */
.todo-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.todo-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.edit-btn {
    background: var(--warning-color);
    color: var(--white);
}

.edit-btn:hover {
    background: #e67e22;
    transform: scale(1.05);
}

.delete-btn {
    background: var(--danger-color);
    color: var(--white);
}

.delete-btn:hover {
    background: #c0392b;
    transform: scale(1.05);
}

/* 빈 상태 */
.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-light);
}

.empty-state p:first-child {
    font-size: 2rem;
    margin-bottom: 10px;
}

.empty-state p:last-child {
    font-size: 0.95rem;
    opacity: 0.7;
}

/* 액션 버튼들 */
.action-buttons {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

.clear-btn, .delete-all-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.95rem;
    min-width: 150px;
}

.clear-btn {
    background: var(--warning-color);
    color: var(--white);
}

.clear-btn:hover {
    background: #e67e22;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.delete-all-btn {
    background: var(--danger-color);
    color: var(--white);
}

.delete-all-btn:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.delete-all-btn:disabled,
.clear-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 편집 모드 */
.edit-mode {
    display: none;
}

.todo-item.editing {
    background: #fff3cd;
    border-left-color: var(--warning-color);
}

.todo-item.editing .todo-text {
    display: none;
}

.todo-item.editing .edit-mode {
    display: flex;
    gap: 8px;
    width: 100%;
    align-items: center;
}

.edit-input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid var(--warning-color);
    border-radius: 6px;
    font-size: 0.95rem;
    font-family: inherit;
}

.edit-input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(243, 156, 18, 0.1);
}

.save-btn {
    padding: 8px 12px;
    background: var(--success-color);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.save-btn:hover {
    background: #45ad68;
}

.cancel-btn {
    padding: 8px 12px;
    background: var(--text-light);
    color: var(--white);
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
}

.cancel-btn:hover {
    background: #555;
}

/* 반응형 디자인 */
@media (max-width: 480px) {
    .todo-app {
        border-radius: 12px;
    }

    .todo-header h1 {
        font-size: 1.5rem;
    }

    .input-section {
        flex-direction: column;
    }

    .add-btn {
        width: 100%;
    }

    .stats {
        flex-direction: row;
    }

    .stat-item {
        flex: 1;
        min-width: auto;
    }

    .action-buttons {
        flex-direction: column;
    }

    .clear-btn, .delete-all-btn {
        width: 100%;
        min-width: auto;
    }

    .todo-actions {
        width: 100%;
        margin-top: 10px;
    }

    .todo-btn {
        flex: 1;
    }
}